以下原型AJAX请求的jQuery等价物是什么?
function showSnapshotComments(snapshot) {
new Ajax.Request('/photos/show_snapshot_comments/'+ snapshot.id,
{asynchronous:true, evalScripts:true});
}发布于 2011-04-05 06:08:32
$.ajax({
url: '/photos/show_snapshot_comments/'+ snapshot.id,
async: true,
dataType: 'script'
});发布于 2011-04-05 06:06:30
您可以使用$.ajax()函数
function showSnapshotComments(snapshot) {
$.ajax({
url: '/photos/show_snapshot_comments/' + snapshot.id,
dataType: 'script'
});
}如果您愿意,也可以使用等效的$.getScript()函数:
function showSnapshotComments(snapshot) {
$.getScript('/photos/show_snapshot_comments/' + snapshot.id);
}https://stackoverflow.com/questions/5544871
复制相似问题