jquery ajax post and response evaluation
Posted
by Rami
on Stack Overflow
See other posts from Stack Overflow
or by Rami
Published on 2010-03-24T04:53:31Z
Indexed on
2010/03/24
5:03 UTC
Read the original article
Hit count: 300
jQuery
Hello people,
i am relatively new to javascript and jquery in particular, so please bear with me, i am trying to loop through multiple s and then serialize() the data with jquery and post it using ajax to my page, this's happening alright, and the data is posted, and my php script echos 1 and everything is taken care off, but for some strange reason, the following code is not working, specially the "success" variable, it's not increasing at all! would you please help me?
$('.submitB').click(function(){
var success = 0;
var times = 0;
var alertText;
$('.input').each(function(){
times++;
var serializedForms = $(this).serialize();
$.post('<?=$this->config->site_url()?>crud/additem/forms', serializedForms ,function(data){
if (data)
{
success++;
}
});
});
if (times)
{
alertText = "?? ????? " + success + " ???? ?? ??? " + times + " ?????.";
alert(alertText);
}
})
the Arabic text just says "success + Entries from + times + were entered successfully"..
thank you in advance.
© Stack Overflow or respective owner