ChrisPHP Posted January 4, 2013 Share Posted January 4, 2013 (edited) Hello everyone, I just wanted to know if $.POST function is still usable in Javascript language because I'm receiving "$.POST is not a function" in debugging.... <?php include("Conx.php"); $sql="SELECT nom FROM client"; $result=mysql_query($sql); $options=""; while ($row=mysql_fetch_array($result)) { $id=$row["nom"]; $options.="<OPTION VALUE=\"$id\">".$id; } ?> <SELECT id="Driver"> <option id="option" name="option" value="">Choose a driver...</option> <?=$options?> </SELECT> <script type="text/javascript"> $(document).ready(function(){ $('#Driver').change(function(){ $.POST("Driver-Modify.php", {nom:$("#Driver").val()}, function(data){ $('input[name="description"]').val(data.description); } ,"json" ); }); }); </script> <?php if(isset($_POST['Driver'])) { $sql = mysql_query("SELECT nom FROM client WHERE nom='" . mysql_real_escape_string($options) . "'"); $row = mysql_fetch_assoc($sql); $arr = array( '#description' => $row['nom']); echo json_encode($arr); } ?> <input type="text" name="description" id="description"/> Thanks in advance. Regards, Chris Edited January 4, 2013 by ChrisPHP Quote Link to comment Share on other sites More sharing options...
kicken Posted January 4, 2013 Share Posted January 4, 2013 (edited) Since you're talking about Javascript, I've moved your topic to the Javascript Help forum. The PHP help forum was the wrong place to post. Two things: 1) It's $.post(), not $.POST. Case sensitive. 2) $.post is not a native javascript function, it is part of the jQuery library so make sure you have included that library into your page if you want to use it. Edited January 4, 2013 by kicken Quote Link to comment Share on other sites More sharing options...
ChrisPHP Posted January 4, 2013 Author Share Posted January 4, 2013 First of all thanks for your quick reply and sorry about any inconvenience. I didn't know that it was case sensitive so it solved my 2 hours problem lol Thanks a lot!!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.