• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
json_encode & header() problem

#1
[eluser]Unknown[/eluser]
I have a function that handles an ajax/json request and responds with a string containing html. It contains the following code.

Code:
header('Content-Type: application/json');
echo json_encode($response); //send the response to the caller


When I the ajax call is made a "Opening validateAdd" dialog box opens up where validateAdd is the name of the ajax handler. I have worked with json before but have not seen this problem. Any ideas?

If I remove the header line the ajax json request completes but with an error as the header shows plain text and the ajax code expected json.



Messages In This Thread
json_encode & header() problem - by El Forum - 04-25-2012, 08:52 AM
json_encode & header() problem - by El Forum - 04-25-2012, 09:37 AM
json_encode & header() problem - by El Forum - 04-25-2012, 11:53 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.