开发者

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

开发者 https://www.devze.com 2023-04-04 22:05 出处:网络
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,

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

精彩评论

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