i have image with it attached form! and when i change some value in form, then it automatically .post() values to other file and updates DB! i also have option to add new image and then it append image and new form for that (new-)image, but form does not .post() values for that new image until i have refreshed the page…. HTML IS 100% CORRECT
var http_adr = "http://192.168.1.200/dev/";
function addPictures(what, where){
AIM.start(what,{
AppendData:{
'parent':where
},
beforeComplete:function(){
},
onComplete:function(returnData){
var jdata=$.parseJSON(returnData);
for (var i=0; i<jdata.filename.length; i++){
var html_var = '<div class="image_wrapper"><div class=""><img src="../../module/catalog/product_img/'+where+'/'+jdata.filename[i]+'_small.jpg" /></div><div class="details_div">';
var html_var2 = '';
for (var n=0; n<jdata.detail_table[i].length; n++){
html_var2 = html_var2 + '<form name="' + jdata.pdid[i] + '">' + jdata.detail_table[i][n] + '<input name="price" value="0.00" /><input name="stock" value="0" /></form>';
}
var html_done = html_var + html_var2 + '</div></div>';
$('.box:visible').append($(html_done).hide().fadeIn(1500));
}
},
UPtarget:http_adr+'plugins/upload/upload.php'
});
}
var iloc = '../../module/catalog/_i.php';
$(document).ready(function() {
$('input').change(function() {
var pdid = $(this).parent('form').attr("name");
$.post(
iloc,
$(this).serialize() + '&pdid=' + pdid + '&a=edit_detail',
function(data) {
}
);
})
})
Try with:
instead of
so when you retrieve a new input from ajax the event bubbles up and be catched and handled.
UPDATE:
Also try changing your following line:
for this one:
because you were hiding and fadeing in an html wasn’t attached to DOM yet.