成功函数中的响应就是您从PHP中获得的回报。因此发送JSON最简单,因为这样您的响应就只是一个对象。
可以说ajax.php返回此JSON
{ "newtextcaption": "whatever the text is", "boxhtml": "whatever your box html is", "AjaxValue": 4389489473289}那么你的成功功能应该是
success: function(response) { $('.gridnr1, .textnr1').fadeOut(400, function(){ $('.textnr2, .gridnr2').fadeIn(400); }); var newtextcaption = response.newtextcaption; var box = response.boxhtml; $('#textnr2').html(newtextcaption); $('#gridnr2').html(box); for (var i=0; i<response.AjaxValue; i++) { DO SOMETHING WITH i; }


