开发者

Translating Prototype Ajax call into jQuery (adding form parameters and loading function)

I am trying to translate this on submit call into a identical call in jquery

onsubmit = "new Ajax.Updater('graph','/test/add', {asynchronous: true, evalScripts: true,
    onLoading:function(request){document.getElementById('load').style.display='block'}, parameters:Form.serialize(this)});

So far I have this function:

$("form").submit(function(e){
 $.ajax({
    url: '/saffron_main/click_out_display',
    success: function (data) {
        $('#graph').html(data);
    }
});

});

However, I am having trouble replicating two pieces of functionality.

  1. parameters:Form.serialize(this)
  2. onLoading:function(request){document.getElementBy开发者_运维百科Id('load').style.display='block'}


$("form").submit(function(e){

 $.ajax({
    url: '/saffron_main/click_out_display',
    data: $(this).serialize(),
    success: function (data) {
        $('#graph').html(data);
        $("#load").css("display","block");
    }
});

});

That should match your needs. If anything is unclear, don't hesistate to ask.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜