1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    35
    Vote Rating
    0
    Limbo is on a distinguished road

      0  

    Default Unanswered: Invalid JSON primitive in Sencha 2.0 - Working in 1.0

    Unanswered: Invalid JSON primitive in Sencha 2.0 - Working in 1.0


    I am getting an "Invalid JSON primitive" error after moving to Sencha 2.0, and can't get it to work.

    The JS code is this:

    Code:
    Ext.regModel('TemplateList', {
    	fields: ['TemplateID', 'StateID', 'Caption', 'Subject', 'ForwardToType', 'ForwardTo', 'DND', 'StateEndingType', 'TextIsRequired', 'DetailsRequired', 'SuggestedEndTime']
    });
    
    
    var myTemplateListXTemplate = new Ext.XTemplate('<div>' +
    '<div class="TemplateStateEndingType{DetailsRequired}">{Caption}</div>' +
    '</div>');
    
    
    myTemplateStore = new Ext.data.Store({
    	model: 'TemplateList',
    	storeID: 'myTemplateStore',
    	autoLoad: true,
    	proxy:
    	{
    		headers: { 'Content-Type': 'application/json; charset=utf-8' },
    		url: 'Ajax.aspx/GetTemplateList',
    		type: 'ajax',
    		limitParam: null,
    		actionMethods:
    		{
    			read: 'POST'
    		},
    		reader:
    		{
    			type: 'json',
    			root: 'd'
    		}
    	}
    });
    The ASP.NET code is this:
    Code:
    [WebMethod()]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    static public AjaxTVTemplate[] GetTemplateList()
    {
    ...
    }
    How do I get this to work in Sencha 2.0? I've read the documentation and tried various changes, but I can't get it to work.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,724
    Answers
    3359
    Vote Rating
    752
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What does the JSON look like?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    35
    Vote Rating
    0
    Limbo is on a distinguished road

      0  

    Default


    Not sure - it's genereated in ASP.NET. It worked with Sencha 1.

    Now it doesn't look like the function is even executed. It does not show up in the browser debugger.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,724
    Answers
    3359
    Vote Rating
    752
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You checked in the Network tab in dev tools?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Feb 2011
    Posts
    35
    Vote Rating
    0
    Limbo is on a distinguished road

      0  

    Default


    Yes that is where I got the error message. This is more information:

    HEADER INFORMATION
    Request URL:http://localhost:53478/iPhone/Ajax.a...=1336049668004
    Request Method:POST
    Status Code:500 Internal Server Error

    Request Headers
    Accept:*/*
    Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
    Accept-Encoding:gzip,deflate,sdch
    Accept-Language:en-US,en;q=0.8
    Connection:keep-alive
    Content-Length:14
    Content-Type:application/json;charset=UTF-8
    Cookie:ASP.NET_SessionId=33at3f3y41lgfdyacm5h4e1e; .ASPXAUTH=C0398D7A8070CB9E9805F57ADCC8C446F6DA729D56B4D6137E4B4C8DB1A92768610E1E47D86BBF7ADDCF30822810DCF80366A3597907DCCF9399F468A7E31063CF0091C18D2270776BF71DBB0A29A2A28E5E51520BBE6DCBC9F80FF62F9B05016DF1A680A4EB7E201BD9F269D5955C427ADA9DABEE8D51D8C99931B95AEB0A3223E09F8967F64786004543EDC219CDEE7136470C52C4632B5644A2D4C9B3B2B918A6FA6D; Edition=Basic
    Host:localhost:53478
    Origin:http://localhost:53478
    Referer:http://localhost:53478/iPhone/
    User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.10 (KHTML, like Gecko) Chrome/20.0.1123.1 Safari/536.10
    X-Requested-With:XMLHttpRequest

    Query String Parameters
    _dc:1336049668004

    Request Payload
    page=1&start=0

    Response Headers
    Cache-Control:private
    Connection:Close
    Content-Length:1062
    Content-Type:application/json; charset=utf-8
    Date:Thu, 03 May 2012 12:54:28 GMT
    Server:ASP.NET Development Server/10.0.0.0
    X-AspNet-Version:2.0.50727
    jsonerror:true

    RESPONSE
    {"Message":"Invalid JSON primitive: page.","StackTrace":" at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)\r\n at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"}

    When I enable the Visual Studio debugger, I can see that it never enters the GetTemplateList in AJAX.ASPX function. So somehow it's not finding the function as it used to in Sencha 1.

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,724
    Answers
    3359
    Vote Rating
    752
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    So it's returning that in the JSON... That would tell me that error is happening on the server
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  7. #7
    Sencha User
    Join Date
    Feb 2011
    Posts
    35
    Vote Rating
    0
    Limbo is on a distinguished road

      0  

    Default


    Yes, somehow the Sencha request is not reaching the correct function, as it did before. So there is some Sencha setting that I am missing.

  8. #8
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,724
    Answers
    3359
    Vote Rating
    752
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Compare the requests between ST1's and ST2's. What's different? Different URL? Different params?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  9. #9
    Sencha User
    Join Date
    Feb 2011
    Posts
    35
    Vote Rating
    0
    Limbo is on a distinguished road

      0  

    Default


    Yes, good idea. I will try to compare the two and see what is different.

    Will get back to you

    Thanks

  10. #10
    Sencha User
    Join Date
    Feb 2011
    Posts
    35
    Vote Rating
    0
    Limbo is on a distinguished road

      0  

    Default


    I have tried this, and one thing I notice is different is that in Sencha 2, I have this in the header:

    Request Payload
    page=1&start=0

    This is not part of the header in Sencha 1. How can I remove this? And what is this?

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar