Please can you help -- why does this JSON not work
the head of my page looks like this
<script src="Scripts/json2.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="Scripts/JScript.js" type="text/javascript"></script>
and my ajax looks like this
var p = { "myText": JSON.stringify(tableOBJ) };
$.ajax({
type: "POST",
url: "Default2AJAX.aspx",
data: p,
success: function (data) {
var obj = JSON.parse(data);
}
});
In firefox I get this error on the JSON
Error: syntax error
Source File: /Scripts/json2.js
Line: 4
Source Code:
<!DOCTYPE html>
In IE 7 I get JSON undefined
in ie 8 i get
SCRIPT1002: Syntax error json2.js, line 4 character 1
In ie 9 i get
SCRIPT1002: Syntax error json2.js, line 4 character 1
How do I fix this? as I have added json2.js but it appear if the browser doesnt need it it throws an error?