Just a quick question about JQuery’s Ajax function, more specifically, the url parameter.
My directory structure is like so:
contact.html
process.php
- elements
- js
- jquery.js
- library.js
Code below
...
// Post with Ajax
$.ajax
({
type : 'POST',
url : '../../process.php',
data : fulldata,
success: function()
{
$('#contact_form #placeholder').html("<div id='success_box'><h3>Message Recieved</h3><p>We will be in touch very soon!</p></div>");
$('#contact_form form').hide();
},
error: function(xhr)
{
alert('Request Status: ' + xhr.status + ' Status Text: ' + xhr.statusText + ' ' + xhr.responseText);
}
});
return false;
Every-time I submit the form, it spits out an error, that I think is the url. How do I correctly specify the process.php file for submission with Ajax?
Thanks
Your script will be running in a page at the same level as the process.php page. it does not run in the context of the js folder. therefore you can point it to the root of your application