jquery 1.5 ajax requests are erroring
trying to upgrade to jQuery 1.5 and all my ajax calls break. I'm running firefox and it gives me a javescript error of invalid Label I'm using php's json_encode here is my json response
{
"page": "1",
"total": 9651,
"rows": [
{
"cell": [
"story",
"51438",
"Skin color: Handy tool for teaching evolution",
"2011-02-20 08:30:26"
]
},
{
"cell": [
"story",
"51435",
"Photosynthesis may hold key to production of cheap hydrogen for fuel",
"2011-02-19 10:00:03"
]
},
{
"cell": [
开发者_如何转开发 "story",
"51478",
"Dancers, supporters ready for THON 2011 Feb. 18-20 at Jordan Center",
"2011-02-18 14:26:25"
]
},
{
"cell": [
"story",
"51420",
"Juggling languages can build better brains",
"2011-02-18 13:30:44"
]
},
{
"cell": [
"story",
"51434",
"Multiple approaches necessary to tackle world's food problems",
"2011-02-18 13:30:44"
]
},
{
"cell": [
"story",
"51436",
"U.S. will no longer dominate science and research, study finds",
"2011-02-18 13:00:49"
]
},
{
"cell": [
"story",
"51492",
"NPR to air interview with Penn State professor today (Feb. 18)",
"2011-02-18 11:20:10"
]
},
{
"cell": [
"story",
"51437",
"Research universities play a major role in national security",
"2011-02-18 10:30:28"
]
},
{
"cell": [
"story",
"51472",
"Paterno's necktie from 400th win nets $10,200 for Public Broadcasting",
"2011-02-18 09:20:52"
]
},
{
"cell": [
"story",
"51363",
"PSU Extension offers free tax preparation help for low-income families",
"2011-02-18 01:32:04"
]
},
{
"cell": [
"story",
"51477",
"Students set to produce complete THON coverage, including webcast",
"2011-02-17 15:24:47"
]
},
{
"cell": [
"story",
"51385",
"The Medical Minute: Seasonal Affective Disorder",
"2011-02-17 12:27:30"
]
},
{
"cell": [
"story",
"51345",
"Abington professor's new book exposes NBA betting scandal",
"2011-02-17 11:59:31"
]
},
{
"cell": [
"story",
"51360",
"Student Stories: Statistical service internship makes it all add up",
"2011-02-17 11:12:32"
]
},
{
"cell": [
"story",
"51453",
"Parking Office announces parking, transit changes related to THON",
"2011-02-17 11:02:46"
]
},
{
"cell": [
"story",
"51444",
"Penn State's Lunar Lion team aims to land vehicle on moon by 2015",
"2011-02-17 08:17:12"
]
},
{
"cell": [
"story",
"51427",
"Students flock to Spring Career Fair",
"2011-02-16 12:56:27"
]
},
{
"cell": [
"story",
"51419",
"Ice Campaign receives $1 million gift from Paul and Nancy Silvis",
"2011-02-16 10:51:45"
]
},
{
"cell": [
"story",
"51353",
"CarbonEARTH program facilitates science education, teaching",
"2011-02-15 15:59:04"
]
}
],
"messages": null
}
all this works fine in jquery 1.4.2
think I'll have to wait to upgrade but thought I would check and see if anyone else had a solution ?
Ok so I found the correct solution after some searching I found a bug report for the jQuery Validate. At the bottom of the report the author of validate provides a forked version which fixes the problem thanks to all for help
Most probably it happens due to a bug in jquery.validate.js. There is a quick (not recommended!) fix jQuery.ajaxSetup({ jsonp: null, jsonpCallback: null});
- if it works for you, look further into different options, there is a discussion of "Invalid Label" problem in version 1.5.
This is a bug and it is fixed in 1.5.1. See ticket http://bugs.jquery.com/ticket/8125, You can find the latest jQuery release with up to date fixes at http://code.jquery.com/jquery-git.js
You can also try jQuery.ajaxSetup({ jsonp: null, jsonpCallback: null});
as per this thread JQuery 1.5 and new "Text JSON" datatype
精彩评论