When creating a JSON data document for a page in Views, the JSONP prefix is not prefixed to the JSON string, nor are the parentheses added. I have not tested all the cases, but I noticed the problem with these values set in the settings form:

View API mode = false (unchecked)
JSON data format = simple
JSONP prefix = someString

Looking at the code, it looks like the file views/theme/views-views-json-style-simple.tpl.php has a bug at line 29. Instead of

 if (isset($_GET[$jsonp_prefix]) && $jsonp_prefix) {
    $json = $_GET[$jsonp_prefix] . '(' . $json . ')';
  }

it probably should just have

  if ($jsonp_prefix) $json = "$jsonp_prefix($json)";

which seems to work in the other cases. I made this change in my copy of the code and it works.

Comments

ontoligent’s picture

Issue summary: View changes
ontoligent’s picture

Ah, I see this has been addressed in another issue. See "JSONP prefix disappears" https://drupal.org/node/2090423

ontoligent’s picture

yannickoo’s picture

Status: Active » Closed (duplicate)