Hi,
I'm new to JQuery/Ajax with PHP.
I'm calling a PHP file, and all the code runs well, except for the echo's.
The echo's are not showing and they were supposed to be showing .
Here are both my files(Which are very simple):
(x.php(main file) and sugere.php(the called file))
X.PHP
<html>
<head>
<script src="jquery-1.7.1.js" type="text/javascript"></script>
<script type="text/javascript" >
function sugere()
{
var tmp="";
$.ajax({
type: "POST",
url: "sugere.php",
data: "name=John&location=Boston",
success: function(msg){
alert("-"+msg+"-");
}
});
return false;
}
</script>
</head>
<body>
<form name="form1">
<?php
echo "hello";
?>
<input type="button" name="name" onclick="sugere();return false;">
</form>
</body>
</html>
sugere.php(the called file)
<?php
echo "<script LANGUAGE='javascript'>alert('uploading...');</script>";
echo "Something";
$con = mysql_connect('localhost', 'user_test', '');
mysql_select_db("test");
$result = mysql_query("insert into user (nick) values('Jquery')" , $con);
mysql_close($con);
?>
Any ideas why the echo's are not working ?
Many thanks in advance!!