troubleshooting Question

Trying to get/parse json(p) with jQuery

Avatar of larsan
larsan asked on
JavaScriptjQuery
7 Comments1 Solution873 ViewsLast Modified:
Hi.

My first attempt att parsing json is frustrating. Because jQuery "fails silently" on json errors, I'm not getting anywhere.

Anyway. I want to retrieve summary and image_src for each item from this json URL - http://www.gp.se/kulturnoje/film?m=json (which I have no control over, and I cannot change it's formatting)
I'm doing this from the same domain, so that I should not have any cross domain issues.
However, I get nothing.

This is my jQuery so far...
(function($) {
    var url = 'http://www.gp.se/kulturnoje/film/?m=json';
    $.ajax({
		type: 'GET',
		url: url,
		async: false,
		jsonpCallback: 'mktmp.appendSpots',
        contentType: "application/json",
        dataType: 'jsonp',
        success: function(json) {
        	console.dir(json);
        }
	});
})(jQuery);

I've also tried with this.
$.getJSON("http://www.gp.se/kulturnoje/film/1.939463-dark-shadows?m=json&callback=mktmp.appendSpots",
  function(data) {
	alert(data);
  })
  .success(function() { console.log("Oh my - success"); })
  .error(function(jqXHR, textStatus, errorThrown) {
          console.log("error " + textStatus);
           console.log("errorThrown " + errorThrown);
      })
  .complete(function() { console.log("complete"); });</script>
which gives me this in the console:
error parsererror jsonb.html:18
errorThrown SyntaxError: Unexpected token m jsonb.html:19
complete

Please assist.

Best regards,
David
ASKER CERTIFIED SOLUTION
Jon Norman
Information Systems Manager
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros