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

Link to comment
https://forums.phpfreaks.com/topic/272706-post-is-not-a-function/
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.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.