javascriptjqueryajax

Jquery Ajax Problem


A have a page that contain two Forms.

When I click on Submit button on the <form> (Without ajax), it keep directing to the ajax page. It shouldnt happen.

Click on the Save button, it direct to save.php and then direct to ajax_list_inquiries.php for some odd readon?! I have to click on the back button on the browser to go back to forms page. Yes it does save.

For example:

<h2> Form (None Ajax) </h2>
<form action="save.php" method="post">
 <input type="name" type="text" /> 
  <input type="submit" value="Save" name="SaveEdit" />
</form>


<h2> Ajax Form </h2>
<textarea id="NoteInquiries"></textarea>
<input type="button" class="AddListInquiries" value="Add" />
<div id="ListInquiries"> </div>

in the JS script file:

$(document).ready(function () {
  function ListInquiries() {
      $("#ListInquiries").load("ajax_list_inquiries.php", {salesid: $("#EditSalesID").val()} );
 }
ListInquiries();
});

Solution

  • $_SERVER['REQUEST_URI'] is updated when you request via ajax.