views:

14

answers:

1

Hello, I would like to create a jquery function that hides page refresh when a form on the page is submitted. I don't mean one that is specific for a particular form on the page but rather for any form on the page. If there is a form submit on the page that submits to itself, don't show page refresh. I'd like to just wrap the page with a div and if anything inside it is submitted, don't show the refresh. (Naturally I don't mean submits that submit to other pages.)

Is this possible? Any one know any articles on how to do this?

Thank you!

A: 

If I have understood you, you need Ajax. Look at functions like:

$.getJSON('ajax/test.json', function(data) {

  $('.result').html($('.result').html()+'<p>' + data.foo + '</p>'
    + '<p>' + data.baz[1] + '</p>');
});

or:

$.ajax({ url: "test.html", context: document.body, success: function(){

....................................... }});
netadictos