Skip to main content

Bug Tracker

Side navigation

#6284 closed bug (worksforme)

Opened March 15, 2010 12:01AM UTC

Closed March 18, 2010 12:38AM UTC

Last modified February 14, 2011 05:28PM UTC

Return json not working in $. ajax

Reported by: dioubernardo Owned by:
Priority: Milestone: 1.4.3
Component: ajax Version: 1.4.2
Keywords: json Cc: diou@vetorial.net
Blocked by: Blocking:
Description

javascript code:

$.post("url ...", "parametros=1", function(d){

alert(d)

}, 'json');

php return:

{p:"",r:"<tr><td>cmsMenu</td><td><i class=\\"ico i8\\"></i> CMS - Menu Base</td><td class=\\"op\\"><a class=\\"ico i1\\" href=\\"/saite/cms/menus/editar/1\\"></a><a class=\\"ico i2\\" href=\\"/saite/cms/menus/delete/1\\"></a></td></tr><tr><td>cmsConteudos</td><td><i class=\\"ico i8\\"></i> CMS - Menu Conteúdos</td><td class=\\"op\\"><a class=\\"ico i1\\" href=\\"/saite/cms/menus/editar/2\\"></a><a class=\\"ico i2\\" href=\\"/saite/cms/menus/delete/2\\"></a></td></tr>"}

the alert is not called. Before upgrading to jquery 1.4 worked.

sorry for my English

if in code javascript replace 'json' by 'text' then the alert is show.

Attachments (0)
Change History (3)

Changed March 18, 2010 12:38AM UTC by dmethvin comment:1

resolution: → worksforme
status: newclosed

The server must produce valid json.

VALID: {"test": "string"} INVALID: { test: "string"} INVALID: { 'test': "string"} INVALID: { "test"": 'string'}

Changed February 12, 2011 10:07AM UTC by anonymous comment:2

THANKS A MILLION dmethvin

After 3 days of useless efforts you came in and saved me

Changed February 14, 2011 05:28PM UTC by anonymous comment:3

Really the code is invalid json

http://www.ietf.org/rfc/rfc4627.txt

The only question is to stop working