Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Stanislav Khromov

    (@khromov)

    Hi manzullo,

    Do you mean that the generated JSON is invalid? Please send a screenshot of your View options and the output that it generates, and I’ll have a look.

    Thread Starter manzullo

    (@manzullo)

    I figured that the error is about the callback function that this plugin doesn’t have.

    I added it manually, i’d like you to integrate this feature for everybody

    Thank You so much

    Plugin Author Stanislav Khromov

    (@khromov)

    Hey @manzullo,

    I’d be happy to do that. Please feel free to open a pull request on GitHub for it:
    https://github.com/khromov/wp-views-output-formats

    Or if you prefer, you can just paste the code here. (Use the “code” button).

    Thanks.

    Thread Starter manzullo

    (@manzullo)

    Hi, i’m sorry but i’m not a programmer and i’m not sure about my modification.

    I modified for my self this condition:

    if($format === 'json')
        header('Content-type: application/javascript');

    and the output like this:

    //Print output

    $callback = $_REQUEST['callback'];
      //start output
        echo $callback . '(' . json_encode($output) . ');';
      //echo $output;

    This generate json like this:

    (“{\”posts\”:[{\”ID\”:6434,\”post_author\”:\”1\”,\”post_date\”:\”2015-05-20 12:24:27\”,\”post_date_gmt\”:\”2015-05-20…

    You can note the round bracket at the beginning, that works for my issue but i’m not sure about that for other people, i really and not sure about this arranged solution to be the right also for me but it works for sencha.

    I tested in many ways the json for 2 days, i noticed that when i putted the json output in a texy file and the output was the same sencha (extJs) didn’t work, so i went to see Json Api code.

    The json api plugin works too, but i use toolset and i prefear to use your plugin. It is my first time trying to implement JsonP

    I can say that Json API doesn’t output the round braket

    Plugin Author Stanislav Khromov

    (@khromov)

    Hi @manzullo,

    Yes, I think I see the issue, the plugin does not support JSONP responses currently. I’ll get back to you when it has been added.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Json not compatible with sencha’ is closed to new replies.