"Set the page content type... ...For JSON, setting it to "text/javascript" would be appropriate."
Not strictly true. The accepted content-type for JSON is text/plain. Seems odd but there's good reason for this. What you return to the browser is text. It's not JavaScript until the code back at the browser runs the eval() method on the string.
@Rod:
"Set the page content type... ...For JSON, setting it to "text/javascript" would be appropriate."
Not strictly true. The accepted content-type for JSON is text/plain. Seems odd but there's good reason for this. What you return to the browser is text. It's not JavaScript until the code back at the browser runs the eval() method on the string.
At least that's how I understand it.