This question already has an answer here:
My Problem:
After the execute of this javascript Code:
$.post( $("#deleteAccountForm").attr("action") ,$("#deleteAccountForm :input").serializeArray(),function(response){
alert(response);
if(response.message === "nomatch"){
$('#hiddenNotFound').show(300).delay(5000).fadeOut();
}
});
It response this:
<br />
<font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Undefined index: id in myPath\deleteAccountStuff.php on line <i>7</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0000</td><td bgcolor='#eeeeec' align='right'>385416</td><td bgcolor='#eeeeec'>{main}( )</td><td title='myPath\deleteAccountStuff.php' bgcolor='#eeeeec'>...\deleteAccountStuff.php<b>:</b>0</td></tr>
</table></font>
<br />
<font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Undefined index: versuche in myPath\deleteAccountStuff.php on line <i>8</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0000</td><td bgcolor='#eeeeec' align='right'>385416</td><td bgcolor='#eeeeec'>{main}( )</td><td title='myPath\deleteAccountStuff.php' bgcolor='#eeeeec'>...\deleteAccountStuff.php<b>:</b>0</td></tr>
</table></font>
{"message":"nomatch","versuche":"1"}
As you can see, the response is full of HTML stuff and my required JSON-Array on the Last line.
PHP-Code:
header('Content-type: application/json');
$arr = array ('message'=>'nomatch','versuche'=>"$versuche");
echo json_encode($arr);
I tried it also with "die(json_encode(array(...)));" but the result remains the same. The "alert(response)" doesn't appear.
My Question:
Why does the HTML-Stuff appear in my JSON-response? Why does the alert Dialog didn't appear?
Hope this is enough information to get a clue what I could had made wrong.
Aucun commentaire:
Enregistrer un commentaire