【发布时间】:2012-05-20 21:48:48
【问题描述】:
现在,当我从我的 ajax 发布请求中取回数据时,我正在尝试使用 $(this).insertFUnctionNameHere()。我试着做一些测试,比如 $(this).parent().hide(); $(this).slideUp();看看它在哪里选择,但它似乎什么也没选择?这是正常的还是我有办法让 $(this) 实际选择一些东西。
这是我的代码。
/*
* This is the ajax
*/
$(".reply").on( "submit" , function(){
// Intercept the form submission
var formdata = $(this).serialize(); // Serialize all form data
// Post data to your PHP processing script
$.post( "/comment.php", formdata, function( data ) {
// Act upon the data returned, setting it to .success <div>
$(this).children().slideUp();
$(this).children('.success').prepend(data);
$('.hidden').hide();
});
return false;
});
/*
* End ajax
*/
我使用它的网站链接是HERE (readysetfail.com)
【问题讨论】:
标签: jquery ajax post request return