title: Retrieve Last mysql rowd ID using ajax / jquery
body: <p>i know how to post data using javascript but im trying to work out how i can retrieve the last inserted row in a mysql table.</p>
  
  <p>So i can use it in my success result.</p>
  
  <p>Below is what i have so far but all it does is create the entry , i really want to direct the user to a page where they can now edit their new entry without having them click a button to go there first.</p>
  
  <p>The code below has not got the part i really need, i just put it up so you can see my structure of what i am doing.</p>
  
  <pre><code>$("#CREATEDOCUMENT").click(function() {
  
  var txt = $.ajax({
  url: 'create_doc_entry.php',
  async: true, 
  type:'POST',
  data:({
  usr_id:$('input#usr_id').val(),
  }) 
  
  }).success;
  
  $('.pleasewait').fadeIn('slow');    
  
  setTimeout(function(){window.location="index.php?v=editdoc&amp;id="+id;}, 2000);
  
  }); 
  </code></pre>
  
  <p>As you can see from the above in the window.location url i have +id</p>
  
  <p>I would really love that +id to be my last inserted id which i grab from the create_doc_entry.php file if you know what i mean.</p>
  
  <p>Thanks in advance
  John</p>