Bug Tracker

Modify

Ticket #1740 (closed bug: worksforme)

Opened 6 years ago

Last modified 6 years ago

JSON Data Truncated When Calling $.ajax Funciton

Reported by: dancablam Owned by:
Priority: major Milestone: 1.2.2
Component: core Version: 1.2.1
Keywords: json ajax Cc:
Blocking: Blocked by:

Description

When calling an AJAX request like so:

$.ajax({

type: "GET", url: "script.php", dataType: "json", cache: false, async: false, success: function(data){

obj = data;

}

});

The $.ajax function will only process approximately 50 characters of the return string, ignoring the rest.

Example JSON Response: {"layer":"48","type":"text","width":43,"height":9,"ratio":0.209302326,"r":1,"g":2,"b":3}

The above JSON string will return: Object layer=48 type=text width=43 height=9 - and will ignore the remainder of the string.

This does note appear to be an issue with the format of the JSON response - if I remove layer, type, width, and height from the above string, then ratio and the remainders will display (up to the next 50 characters).

I have also attempted this response with async set to true - same issue.

Please advise.

Many thanks, Dan

Change History

comment:1 Changed 6 years ago by dancablam

Additional Info:

The same issue also occurs when calling $.getJSON

Also, I am specifying the correct content type: Content-Type: text/json

comment:2 Changed 6 years ago by dancablam

ISSUE RESOLVED

Problem was traced to my debugger program, which was not reporting all elements returned in the created object, jquery was NOT at fault. Please close and thanks!

comment:3 Changed 6 years ago by davidserduke

  • need changed from Patch to Review
  • Status changed from new to closed
  • Resolution set to worksforme

Author has reported it works for him so closing.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.