Jump to content

$.POST is not a function


ChrisPHP

Recommended Posts

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 by ChrisPHP
Link to comment
Share on other sites

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 by kicken
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.