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.
parameters:Form.serialize(this)
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.
精彩评论