Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax posting notes with specific id
    text
    copied!<p>I have a index.php-file that hold some client data, each client data has a unique id. A "create-a-note"-form (using ajax) sends a note to mysql table and instant post the note to index.php. The problem is that i can't get the client_id over to the processing file so all records is being displayed on all clients:</p> <p>index.php</p> <pre><code>echo " &lt;div class='note' id='typenote".$clients_id."'&gt; &lt;form&gt;*the form*&lt;/form&gt; &lt;/div&gt; &lt;div id="notes"&gt;&lt;/div&gt; "; </code></pre> <p>Script</p> <pre><code>$(document).ready(function(){ function showNote(){ $.ajax({ type:"post", url:"process.php", data:"action=shownotes", success:function(data){ $("#notes").hide().html(data).fadeIn('slow'); } }); } showNote(); $("#button").click(function(){ var user=$("#user").val(); var note=$("#note").val(); var client_id=$("#client_id").val(); $.ajax({ type:"post", url:"process.php", data:"user="+user+"&amp;note="+note+"&amp;client_id="+client_id+"&amp;action=addnote", success:function(data){ showNote(); } }); }); }); </code></pre> <p>Process.php</p> <pre><code> include("connect.php"); $action=$_POST["action"]; if($action=="shownotes"){ $show=mysql_query("Select * from sys_notes order by note_id desc"); etc... } } else if($action=="addnote"){ etc... </code></pre> <p>HERE IS THE PROBLEM... How do i get the value of $client_id</p> <pre><code>Select * from sys_notes WHERE client_id=$client_is order by note_id desc </code></pre> <p>in the process.php-file so correct notes is populated in my showNote() scripts id (#notes)?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload