开发者

load a post into a div

In effect, I want to say this:

$('#results1').html($.post("videoloaderurl.php", { id: byName } ));

Obviously, t开发者_StackOverflow中文版he code above doesn't work. where results1 is a div and videoloaderurl.php returns html.


You should provide success callback function for post function, which could add retrived data to the div.

$.post("videoloaderurl.php", { id: byName }, function(data) {
  $('#results1').html(data);
});


$.post() is an AJAX method - meaning it is Asynchronous. You have to wait for the data to be returned and do something in the callback rather than the function returning the value.

$.post("videoloaderurl.php", { id: byName }, function(d){
    $('#results1').html(d)
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜