-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSONP #3
JSONP #3
Conversation
Cool, I've merged in your patch, thanks. |
Thanks for this, awesome! No extra PHP code or configuration is required on the server side with this patch, just supply either the parameter I'm using this for a Sencha Touch app where I need access cross domain - but I think maybe a jquery example might be more illustrative - jquery's
Jquery replaces the question mark in Good explanations of typical JSONP usage here (jquery): Hope that helps |
Thanks a lot Chris! However, I think your example works equally well without the JSONP patch by just using jQuery's success handler? E.g.
I've added another example in the docs. |
Hi Kevin, thanks for adding the documentation, looks great! Yes - while the JSONP patch isn't necessary to read json in jquery, its my understanding the example you have above will only work if the javascript is executed on the same domain as the json feed its calling? If the json url is on a different domain, ?callback=? must be added to the url so jquery knows to use the script method rather than a standard ajax call (http://api.jquery.com/jQuery.getJSON/#jsonp) - and the server must return the json wrapped in the passed in callback name which is where the patch comes in. So this patch is only really useful for those needing to access their json in cross-domain or for public api access via javascript. Also, just thought about something else - after reading this: http://www.metaltoad.com/blog/using-jsonp-safely I think the callback parameter needs to be sanitized. I can submit another patch if you want? Best |
Ah, thanks a lot for clarifying. I've never used JSONP before. |
That's cool, thanks for sorting. Again thanks your hard work on this plugin it's made my life a lot easier... also haven't forgot about donating will do so asap. Cheers |
Thanks man, appreciated : ) |
Hi Kevin
I've been using your plugin for a few months now very successfully (donation on its way!) so thanks for all your hard work. However I needed the plugin to return data in JSONP format so I made some simple modifications to wrap the output in a callback function passed in the initial request.
Feel free to reject but thought it might be of use to others needing JSONP access to their cakePHP app. Any feedback appreciated.
Best wishes
Chris