ChrisPHP Posted January 4, 2013 Share Posted January 4, 2013 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 Link to comment https://forums.phpfreaks.com/topic/272706-post-is-not-a-function/ Share on other sites More sharing options...
kicken Posted January 4, 2013 Share Posted January 4, 2013 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. Link to comment https://forums.phpfreaks.com/topic/272706-post-is-not-a-function/#findComment-1403288 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!!!! Link to comment https://forums.phpfreaks.com/topic/272706-post-is-not-a-function/#findComment-1403291 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.