Ajax data is not defined error
Hi,
Below is my ajax code along with html and php code.
I am getting an error "title is not defined"..
Ajax
------
function callAjax() {
$.ajax ({
type: "POST",
url: "get.php",
data: "title=" + title,
success: function(msg) {
alert(msg);
},
error: function(msg){ alert(msg); },
});
}
HTML
------
<form method="post" onsubmit="callAjax();">
<div class=><label for="title">Title:</label><input type="text" name="title" /></div><br/>
<input type="submit" value="submit"></form>';
get.php
--------
<?php
$title = $_POST['title'];
echo $title;
?>
Related Article: AJAX refresh of php+html
is a JavaScript / DHTML / AJAX discussion thread by lilleskut that has 1 reply, was last updated 1 year ago and has been tagged with the keywords: ajax, php, html, string.
code_rum
Junior Poster in Training
50 posts since Feb 2013
Reputation Points: 8
Solved Threads: 8
Skill Endorsements: 3
Question Answered as of 3 Months Ago by
radhakrishna.p