Skip to main content

Bug Tracker

Side navigation

#8454 closed bug (duplicate)

Opened March 06, 2011 07:06PM UTC

Closed March 08, 2011 09:05PM UTC

Last modified March 14, 2012 06:15PM UTC

Error with using method getJSON in jQuery 1.5.1

Reported by: alexuyt@gmail.com Owned by: alexuyt@gmail.com
Priority: undecided Milestone: 1.next
Component: ajax Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:
Description

I've used in my project jQuery 1.4.4, decided to move to version 1.5.1 and I have a problem with method getJSON.

My JS code:

$.getJSON("<s:url action="checkRegistryErrorsNumber" includeParams="none" />",
                         {"registry.id": <s:property value="registry.id" />},
                        function(data) {
                            $("#errorsNumber").text(data.errorsNumber);
                            if (data.errorMessage != "") {
                                $("#messagesBlock").html(data.errorMessage);
                            }
        });

I'm using Struts 2.0.14 and you see some struts tags from jsp page. That is response:

<%@page contentType="application/json;charset=UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
{
    "errorsNumber": "<s:property value="registry.errorsNumber" />",
    "errorMessage": "<s:actionerror />"
}

Using jQuery 1.4.4 - all OK

Using jQuery 1.5.1 - error in FF : "Invalid label"

What has changed in the new version? Why the request has not working? Bug in jQuery?

Attachments (0)
Change History (4)

Changed March 06, 2011 11:43PM UTC by rwaldron comment:1

component: unfiledajax
owner: → alexuyt@gmail.com
status: newpending

Is this some kind of template code? If not, then you'll need to provide a reduced test case, because this code is full of syntax errors.

$.getJSON("<s:url action="checkRegistryErrorsNumber" includeParams="none" />",
                         {"registry.id": <s:property value="registry.id" />},
                        function(data) {
                            $("#errorsNumber").text(data.errorsNumber);
                            if (data.errorMessage != "") {
                                $("#messagesBlock").html(data.errorMessage);
                            }
        });

Changed March 08, 2011 07:13AM UTC by altro comment:2

This was code from jsp-page with using struts taglib.

This is generated final code:

$.getJSON("/eirc/eirc/checkRegistryErrorsNumber.action", 
          {"registry.id": 131},
          function(data) {
              $("#errorsNumber").text(data.errorsNumber);
              if (data.errorMessage != "") {
                  $("#messagesBlock").html(data.errorMessage);
              }
          }
);

This is response content in Chrome:

{
    "errorsNumber": "157714",
    "errorMessage": ""
}

This is error in Chrome:

Uncaught SyntaxError: Unexpected token :

d.d.extend.globalEvaljquery-1.5.1.min.js:16

d.ajaxSetup.converters.text scriptjquery-1.5.1.min.js:16

bQjquery-1.5.1.min.js:16

vjquery-1.5.1.min.js:16

d.support.ajax.d.ajaxTransport.send.cjquery-1.5.1.min.js:16

Changed March 08, 2011 09:05PM UTC by jaubourg comment:3

resolution: → duplicate
status: pendingclosed

Changed March 08, 2011 09:05PM UTC by jaubourg comment:4

Duplicate of #8084.