web*_*evy 4 ajax jquery prototypejs
什么是jQuery相当于以下Prototype AJAX请求?
function showSnapshotComments(snapshot) {
new Ajax.Request('/photos/show_snapshot_comments/'+ snapshot.id,
{asynchronous:true, evalScripts:true});
}
Run Code Online (Sandbox Code Playgroud)
你可以使用这个$.ajax()功能
function showSnapshotComments(snapshot) {
$.ajax({
url: '/photos/show_snapshot_comments/' + snapshot.id,
dataType: 'script'
});
}
Run Code Online (Sandbox Code Playgroud)
或者$.getScript()你喜欢哪个函数是等价的:
function showSnapshotComments(snapshot) {
$.getScript('/photos/show_snapshot_comments/' + snapshot.id);
}
Run Code Online (Sandbox Code Playgroud)
$.ajax({
url: '/photos/show_snapshot_comments/'+ snapshot.id,
async: true,
dataType: 'script'
});
Run Code Online (Sandbox Code Playgroud)