I simply want to submit form data (JS) to php script. I am using following code:
form.children("div").steps({
headerTag: "h3",
bodyTag: "section",
transitionEffect: "slideLeft",
onStepChanging: function (event, currentIndex, newIndex){
form.validate().settings.ignore = ":enabled,:hidden";
return form.valid();
},
onFinishing: function (event, currentIndex){
form.validate().settings.ignore = ":enabled";;
return form.valid();
},
onFinished: function (event, currentIndex, name){
var name = JSON.stringify($("#userName").val());
var password =JSON.stringify( $("#password").val());
$.ajax({
url: "getInfo.php",
type: "POST",
dataType: "json",
data: {username: name, password: password},
success: function(response) {
$('#response').append(response);
}
});
}
});
The script "getInfo" receives the sent data "username" and password" and can perform further actions like db calls etc. Now I want to echo a table like:
echo "table..[some data]..";
But the correspondig div "response" remains empty.. If I change the dataType to "text", the .append actually appends something (although not correctly..) but now the webserver throws an error concerning a constant which is used somewhere else in the php script..
I think I am missing a basic thing here, but I really did not find a solution...