I try to get jsonp but i receive this error Uncaught SyntaxError: Unexpected token :
Is jsonp supporti n this module, how i must configure it?

$.ajax({
	        url: 'http://www.example.com?callback=?',
	        dataType: 'jsonp',
	        jsonp: 'jsoncallback',
	        timeout: 5000,
			success: function(data, status){
				$.each(data, function(i,item){
	                var landmark = '<h1>'+item.title+'</h1>'
	                + '<p>'+item.body+'<br>'
	                + ' '+'</p>';
	                output.append(landmark);
	            });
	        },
	        error: function(){
	            output.text('There was an error loading the data.');
	        }
	    });

Comments

SilviaT’s picture

Same problem here with D7.
I've seen there's another issue about this for D6 (http://drupal.org/node/606332) but I was wondering is it supposed to work in the D7 version or not?

oskar_calvo’s picture

I have the same problem.

What happens with this?

The json-p is a very important part of any drupal configuration if we want to drupal as a banck-end for mobile apps.

Anything news about this, or how to configure the views to get a correct json-p callback?

Thanks

Oskar

alexander allen’s picture

Could you post an example the output you are getting from the views_datasource module?

Thank you,
Richard

oskar_calvo’s picture

Here is my jsonp code:

callback({
  "nodes" : [
    {
      "node" : {
        "title" : "fdsafsadfdsafdsaf"
      }
    },
    {
      "node" : {
        "title" : "Illum Nobis"
      }
    },
    {
      "node" : {
        "title" : "Appellatio Commoveo Consequat Ymo"
      }
    },
    {
      "node" : {
        "title" : "In Tincidunt Velit Virtus"
      }
    },
    {
      "node" : {
        "title" : "Fere Immitto Veniam"
      }
    },
    {
      "node" : {
        "title" : "Quibus Rusticus"
      }
    },
    {
      "node" : {
        "title" : "Consectetuer Diam Duis Scisco"
      }
    },
    {
      "node" : {
        "title" : "Camur Odio Ratis"
      }
    },
    {
      "node" : {
        "title" : "At Brevitas Loquor Ulciscor"
      }
    },
    {
      "node" : {
        "title" : "Conventio Saluto"
      }
    }
  ]
})

And I can attach also the view if you need it.

yannickoo’s picture

Status: Active » Closed (duplicate)

This is also a duplicate of #1673488: JSONP has no dynamic callback.