kevinhakanson.com

My first jQuery ticket

May 20, 2009 #javascript #jquery #opensource

Back in May 2009, I created my first jQuery ticket: Use native JSON.parse if available inside ajax.httpData

In jQuery.ajax.httpData, would you consider using the native JSON support (​http://www.json.org/js.html) if available? Below is some untested sample code. Maybe the (JSON && JSON.parse) check is better located under jQuery.support.JSON and could be expanded to check if JSON.parse is a function?

// Get the JavaScript object, if JSON is used.

if ( type == "json" )
  if (JSON && JSON.parse)
  	data = JSON.parse(data);
  else 	
  	data = window["eval"]("(" + data + ")");

Today, it was fixed and closed by John himself.


Kevin Hakanson

Multi-Cloud Certified Architect | DevSecOps | AppSec | Web Platform | Speaker | Learner | Builder
Twitter | LinkedIn | GitHub | Stack Overflow | Credly

© 2024 Kevin Hakanson (built with Gatsby)