开发者

load a post into a div

开发者 https://www.devze.com 2023-03-22 04:47 出处:网络
In effect, I want to say this: $(\'#results1\').html($.post(\"videoloaderurl.php\", { id: byName } ));

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

精彩评论

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