You can fix it by yourself.
file views-views-json-style-simple.tpl.php line 23

form
if ($jsonp_prefix) $json = "$jsonp_prefix($json)";
to
if ($jsonp_prefix) $json = $_GET[$jsonp_prefix]."($json)";

Comments

pasqualle’s picture

Component: Miscellaneous » Code
Assigned: koobitor » Unassigned
Priority: Critical » Normal
Status: Fixed » Needs review
alanburke’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

Still an issue on the Drupal 7 version.
Fix still works - line 28.
Thanks!

guile2912’s picture

Having a dynamic way to set the callback name in jsonp is a must have ! here is the patch of this feature

yannickoo’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

This is really a must have otherwise you cannot make a JSONP AJAX request!

Patch still works and looks fine, so RTBC!

yannickoo’s picture

yannickoo’s picture

Title: resolved jsonp is not defined callback value » JSONP has no dynamic callback
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new654 bytes

Sorry but there is a problem if no $_GET parameter was set (e.g. fetching the JSON via PHP) so I re-created the patch.

chrism2671’s picture

Can somebody explain how this is supposed to work with AngularJS? What do I need to send as the 'jsonp_prefix' parameter from $http? Thanks!

chrism2671’s picture

Hi yannickoo,

I'm not sure your patch is correct.

In my opinion:

1) You use $_GET[$jsonp_prefix] which I think should be $_GET['jsonp_prefix']
2) You should be using || instead of &&.

yannickoo’s picture

Hey Chris, that's correct because we have to check whether the $json_prefix is available in the $_GET array. The key is not 'json_prefix' it is $json_prefix. It is dynamic so that you can set it in the Views UI.

chrism2671’s picture

Ah got it! Thanks for pointing that out!

yannickoo’s picture

Status: Needs review » Needs work

But I would switch them, first the isset and then checking for a value...

yannickoo’s picture

Status: Needs work » Needs review
StatusFileSize
new654 bytes
yannickoo’s picture

Status: Needs review » Fixed

Fixed with 6e9b6b9.

yannickoo’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Fixed » Patch (to be ported)
yannickoo’s picture

Fixed with 5c0c7aa.

yannickoo’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.