Jquery and forms

Hi Experts,

I have this script that sends a form...

    $(document).ready(function (){
         $('form[name=admin]').submit(function (){
                $.get("/actions/add/blog.php", $('form[name=admin]').serialize(), function(data){$('#form-message').html(data);});
                return false;
         });
    });


What i really would like is to use this script (which works perfectly) but for it to follow the actual forms action url...

Can this be done? with variables? Get action attr? Its because there are multiple forms across my site...
Many Thanks in Advance
maccaj51Asked:
Who is Participating?
 
leakim971PluritechnicianCommented:
$(document).ready(function (){
         $('form[name=admin]').submit(function (){
                $.get( $(this).attr("action"), $('form[name=admin]').serialize(), function(data){$('#form-message').html(data);});
                return false;
         });
    });
0
 
maccaj51Author Commented:
this seems to load the current url into #form-message on submit...?
0
 
maccaj51Author Commented:
My bad... made a glaring error! Many thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.