I am trying to create a page that I can edit the contents of a <textarea> and when I click Submit, it should update mysql DB. When I click the submit button. Firebug is giving me this error:
NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument
Can anyone tell me why I am getting that error? Here is my code:
HTML
<form id="homeForm" method="post">
<textarea cols="100" rows="20" id="hometext" name="hometext"><?php echo $pagetext ?></textarea>
<input class="submit" type="submit" id="submit" value="Submit" />
</form>
Jquery/ajax
$(document).ready(function(){
$('#homeForm').submit(function(){
var homeText = $('textarea#hometext').val();
$.ajax({
url: "PHPscripts/updateHomeText.php",
type: "POST",
data: {'hometext' : hometext},
success: function(data) {}
});
return false;
});
});
You try to passe
data: {'hometext' : hometext}buthometextisn’t declared in your code. Did you meanhomeText?Just a little mistake. Check the case and accord the variables names.