开发者

jQuery equivalent to Prototype Ajax.Request

What would be the jQuery equivalent to the following Prototype AJAX Request?开发者_开发百科

function showSnapshotComments(snapshot) {
   new Ajax.Request('/photos/show_snapshot_comments/'+ snapshot.id,
                    {asynchronous:true, evalScripts:true});
}


You could use the $.ajax() function

function showSnapshotComments(snapshot) {
    $.ajax({
        url: '/photos/show_snapshot_comments/' + snapshot.id,
        dataType: 'script'
    }); 
}

or the $.getScript() function if you prefer which is equivalent:

function showSnapshotComments(snapshot) {
    $.getScript('/photos/show_snapshot_comments/' + snapshot.id); 
}


$.ajax({
  url: '/photos/show_snapshot_comments/'+ snapshot.id,
  async: true,
  dataType: 'script'
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜