?
Solved

Jquery and forms

Posted on 2011-10-12
3
Medium Priority
?
199 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:maccaj51
  • 2
3 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 36955368
$(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
 

Author Comment

by:maccaj51
ID: 36955414
this seems to load the current url into #form-message on submit...?
0
 

Author Closing Comment

by:maccaj51
ID: 36955422
My bad... made a glaring error! Many thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question