Use of a PHP Function() as a url in Jquery
how does one go about using a function as a URL in an Ajax form submission? In PHP I have a form wherein I use a function as the action
which works well. However, the form is submitted via Ajax and I need a method in which to use the same function above in the Ajax URL
<form action="<?php echo insert()" method="POST" id="addmail">
do I have to use routing for this? I started out trying to use a class with a method within it to run this form. It became painfully obvious that I could not do that with straight PHP. I have a page in which I'm going to have several forms and I did not want to have to write a separate PHP script (php file) for each form, I really wanted to put them in a functions page.
url: "insert()", <------
Thank you for your consideration
You could get the action of the form and use that as the url instead of trying to insert it into the js file. Something like the following (untested):
sorry... double post
Now that looks promising. Will check that out. Thank you
I have a few things to work out here but I think you may have a winner here. Thank you ever so much
Last edited by mrwilson; 12-14-2012 at 04:38 PM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread