相当于以下原型(prototype) AJAX 请求的 jQuery 是什么?
function showSnapshotComments(snapshot) {
new Ajax.Request('/photos/show_snapshot_comments/'+ snapshot.id,
{asynchronous:true, evalScripts:true});
}
最佳答案
您可以使用$.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);
}
关于jQuery 相当于原型(prototype) Ajax.Request,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5544871/