I am trying to build a jQuery functionality for which the scenario is given below.
Consider a user clicks on an image in the website, a jQuery dialogue box pops up on the page. The dialogue box has a text field to enter the ‘alternative text’ for the image. When the user clicks on the submit button, the text from this page should get saved into my central website’s database along with the url of the image.
I have been able to get the jQuery dialogue box working (by going step and step in jQuery) with the following code http://pastebin.com/nxALvAPP
But I wanted the help to save the ‘image text’ and it’s url in the database from. How can that be done? I am not really a pro.
Thanks for help!
You’d have to pull an ajax request to a php page with the values of the fields as data. Take a look at http://api.jquery.com/jQuery.ajax/
As you’ve came so far, I don’t believe this causes any problems for you.
///////////////////
Basically what you do is:
add an click-event to the submit button:
within this action, you call up a file and add data, for example:
This sends a request to savetext.asp with data ‘title’ (which has the value of the input field with the id title). I’m not sure what’s the equivalent of PHP’s $_REQUEST but this parameter (title) is send in the URL to the file savetext.asp.