#6284 closed bug (worksforme)
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@… |
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.
Change History (3)
comment:1 Changed 13 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:2 Changed 12 years ago by
THANKS A MILLION dmethvin After 3 days of useless efforts you came in and saved me
comment:3 Changed 12 years ago by
Really the code is invalid json http://www.ietf.org/rfc/rfc4627.txt
The only question is to stop working
The server must produce valid json.
VALID: {"test": "string"} INVALID: { test: "string"} INVALID: { 'test': "string"} INVALID: { "test"": 'string'}