This project has moved and is read-only. For the latest updates, please go here.
3
Vote

jQuery 1.4.2 incompatible

description

Hello! I just want to say thanks for the excellent project.
 
I am running into a small problem with the dynamic maps not working when I use jquery 1.4.2 instead of jquery 1.3.2 as in the example. Are there any workarounds to make this work with the latest version of jquery?
 
Thanks in advance,
Victor

comments

VictorFoster wrote May 3, 2010 at 8:50 AM

The workaround for this issue right now is to either use jquery 1.3.2 or use the jquery.compat-1.3.js file with jquery 1.4.2. The error probably relates to malformed json of which jquery 1.4.2 does not allow.

wrote May 24, 2010 at 7:40 PM

dskwarek wrote May 31, 2010 at 9:31 PM

The problem is related to the json. Json keys MUST be inside quotes.

http://api.jquery.com/jQuery.post/
"Actually $.post works perfectly in all cases, if you respect 2 rules:
  • from PHP, Python or whatever the returned content-type MUST be application/json
  • the JSON must be valid according to the JSON specification:
    {"key1":"val1","key2":"val2"}
    You can skip the quotes with integer values, but keys and string values MUST be inside quotes. Construct valid in Javascript are not automatically valid in JSON."
I added quotes to all json keys and now I'm using MvcMaps with jQuery 1.4.2.
It's great library. I hope you will continue to add some new features and maybe support for Google Maps V3.

wrote Apr 13, 2011 at 10:04 AM

CtrlAltDel wrote May 10, 2011 at 7:49 AM

The workaround as suggested by dskwarek above is to change the JsonObjectBuilder to enclose the keys with quotes (line 161 in r60450):

sb.Append(string.Format("\"{0}\":{1}", val.Key, strVal));

This change works for me, still using jQuery 1.4.2. The code already takes care of properly enclosing the values with quotes.

wrote Feb 14, 2013 at 3:52 AM