I have a problem calling JQuery AJAX on Firefox (3.6.13 to 4.x) on Mac (OS-10.5). The problem only occurs when the user is โManaged for Parental Controlsโ. This does not happen for Standard or Administrator users, and it does not happen for Safari or Chrome for any users. This problem does not occur anywhere in the Windows environment.
I have a simple ASP.NET page (ASPX) that calls a simple ASP.NET web service (ASMX). Error message returned:
Exception Type: System.ArgumentException Message: Invalid object that was received, ':' or '}' expected. (23): {'data': 'something'Pr Stack Trace: in System.Web.Script. Serialization.JavaScriptObjectDeserializer.DeserializeDictionary (Int32 depth) in System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal (Int32 depth) in System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize (string input, Int32 depthLimizer, JavaScript. Web.Script.Serialization.JavaScriptSerializer.Deserialize [T] (line input) in System.Web.Script.Services.RestHandler.ExecuteWebServiceCall (HttpContext context, data from the WebServiceMethodData method)
This error occurs during JSON deserialization and does not actually apply to the service method. Note that the letters "Pr" are inserted into the JSON object being passed, and the trailing brace is omitted (which causes an error): "{'data': 'something'Pr". The letters "Pr" do not appear in the column when I examine it in Firebug.
It looks like a bug in Firefox for me. Any thoughts?
Here is the code:
WEB SERVICE:
using System; using System.Web; using System.Web.Services; namespace TestWebApp { [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] [System.Web.Script.Services.ScriptService] public class MacAjaxTestService : System.Web.Services.WebService { [WebMethod] public string TestServiceCall(string data) { return "Data Received = '" + data + "'."; } } }
ASPX PAGE:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MacAjaxTest.aspx.cs" Inherits="TestWebApp.MacAjaxTest" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>MAC AJAX TEST</title> <script language="javascript" type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.1.min.js"></script> <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.min.js"></script> <script type="text/javascript" language="javascript"> $(function () { $("#TestButton").button().click(TestButton_Click); $("#TestText").focus(); $("#ResultsDiv").text("").css({ "border": "solid 1px #999999", "width": "600px", "min-height": "100px" }); }); function TestButton_Click() { $("#ResultsDiv").text(""); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "MacAjaxTestService.asmx/TestServiceCall", data: "{ 'data' : '" + $("#TestText").val() + "' }", dataType: "json", success: function (data) { $("#ResultsDiv").text(data.d); }, error: function (jqXHR, textStatus, errorThrown) { </script> </head> <body> <form id="form1" runat="server"> <div> <h2>MAC AJAX TEST</h2> <br /> <input type="text" id="TestText" /> <input type="button" id="TestButton" value="Test" /> <br /><br /><br /> Results: <br /> <div id="ResultsDiv"></div> </div> </form> </body> </html>
source share