jsonp

What is the difference between JSON and JSONP?

Possible Duplicate: Please explain JSONP For example in the jQuery documentation I find both JSON and JSONP mentioned. What is the difference exactly? How can I see which is which? Which one should be used for what? And what does the PHP function json_encode generate? ...

Can I use IP addresses to limit API access

I have a mini API that is only for an app I have built. The API service is on a separate domain to my app. I make jsonp calls to it and receive json in return. Therefore I only want my app to be able to access it. Can I just list a series of IP addresses for my app and allow them? Is there a better way to stop requests from anyone else ...

jQuery 1.4.2 $.ajax with specified jsonpCallback crashes IE6/7

I posted a similiar thread before here, but after further investigation I've found that the problem is with $.ajax jsonpCallback parameter. In the following simple code it crashes every time on the 2nd request (cache problem?) <html> <head> <title>Hello world</title> </head> <body> <span id="ClickMe">Click Me</span> </body> <script s...

passing request params from jQuery to jersey service using json

hi, im trying to POST (cross domain) some data to a jersey web service and retrieve a response (a GenericEntity object). The post successfully gets mapped to my jersey endpoint however when i pull the parameters from the request they are empty.. $ .ajax({ type: "POST", dataType: "application/json; charset=utf-8", url: jersey...

JSONP context problem

I'm using a javascript autocomplete () in a greasemonkey script. On itself it works correctly but I wan't to add JSONP because I want the data from another domain. The code (snippet): function autosuggest(url) { this.suggest_url = url; this.keywords = []; return this.construct(); }; autosuggest.prototype = { construc...

use jsonp to get xml cross domain

I am trying to read xml into a webpage from another server, and I assume that my problem is Same-Origin Policy, and therefore a cross domain problem. I have a bit of googling and it seems that jsonp is the way forward. Based on some examples I found here on stackoverflow and another sites, this is what I have, and it does not "hit" the ...

jQuery - consuming JSON resources - some return data, others don't. Why?

I'm trying to figure out how to consume json URLs in the browser and render the data in my web pages using DOM. I am not getting a consistent or predictable response. I found a JSON URL at Google Calendar which shows the json response in my browser if I just type the URL in the address bar. I found another JSON URL at business.gov whi...

JSONP and sharing cookies from one server to another?

I'm working on an intranet system (.NET 3.5); the main pages are served up from a standard ASP.NET server. I would like to use Ajax on those pages to contact a WCF service running on a different machine, to retrieve data, do CRUD operations - the usual Ajax stuff. The problem I'm trying to resolve is: can I take cookies which were set ...

getting raw json string use jquery ajax method meet problem

I use jquery ajax method, set datatype json, I get a jsonp response from a cross-domain server. But what i want is raw string of json response. so i set datatype text, but i got nothing but a empty string. $.ajax({ url:"http://api.douban.com/book/subject/isbn/9787802057388?alt=xd&amp;callback=?", dataType:'text', ...

How can I wrap my JSP-generated HTML in a JSONP wrapper?

I have a JSP page that renders a block of HTML. In normal usage, I load the contents of the JSP using AJAX (specifically, using jQuery.load()) and insert it into the page. Now, I need to be able to load this block of HTML into a different domain, which means the same-source restrictions won't allow me to use "normal" AJAX. This block ge...

jQuery + JSONP + Yahoo Query Language

I want to get live currency rates from an external source, so I found this great webservice: Currency Convertor This service is working like a charm, the only downside is that it does not provide JSONP results, only XML. Therefore we have a cross browser problem while trying to consume this webservice using jQuery $.ajax(). So I found...

Troubles with JSONP Request

Ok, I'm not 100% sure what I'm doing wrong here. Maybe I just need a second pair of eyes to reveal the error of my ways. I'm sending a JSONP request using jQuery from one domain (https://customerhub.net) to a PHP script on my domain (https://dankennedy.com) and getting a response from that script. I know the request is working because...

illegal character in jsonp response

Hi i am doing an exercise where I am trying to scrape content of nytimes website using javascript/ajax. In order to send cross domain ajax request I am using a proxy server that returns me jsonp response with nytimes website content. But since that html content has some charaters (single quotes) which throws "Illegal Character" error. ...

PHP: Is this safe for providing JSONP?

<?php header('content-type: application/json'); $json = json_encode($data); echo isset($_GET['callback']) ? "{$_GET['callback']}($json)" : $json; Or should I for example filter the $_GET['callback'] variable so that it only contains a valid JavaScript function name? If so, what are valid JavaScript function names? Or is not ...

Check status of a jQuery ajax request.

It seems that the success, error, and complete callbacks only fire when the ajax request is able to get some response from the server. So if I shut down the server the following error callback is not executed and the request fails silently. $.ajax({ type: "GET", url: "http://localhost:3000/", dataType: "script", success: functi...

jquery, jsonp, error handling & security issues

in jquery 1.3.2 for jsonp requests i used to this var _options = { url: 'someexternal_url', type: 'GET', dataType: 'jsonp', success:_aSucFnToHandle, error: _anErrFnToHandle }; $.ajax(_options);// this ignores any error if occurs on url so i added below script and changed my ajax reques...

$.getJSON from jQuery (in Rails app) not reading JSON from cross-domain Node.js/Express app / jsonp?

From googling/forums I think there could be two issues, neither of which I know how to fix: 1) I need to do something with the jsonp callback in the node.js request (which was generated automatically by jquery b/c of the callback=? param) - either add it to the header (where? and how?) or add it to the json response (again, where? and h...

JSONP vs IFrame?

Soon I'll be needing to build a widget that some of our clients can embed in their own websites. To future proof my widget the embed code would be something like this: <script type="text/javascript" src="path/to/remote/file.js"></script> <div id="my_widget"></div> What are the strengths and weaknesses of iframes vs JSONP? Are there ...

AJAX loaded content to be crawable by google

Hey guys, Here is my case: I use some external source to load html data to my page, after that I put content of this html to div. So, as soon as page loaded and ajax call finished, I see the results. It works, Ok.. but now I came up, that this dynamically loaded content is not crawable by Google bot.. and this is something that I don't...

need help with nested jquery function

Hi Please find my code below. My problem is that I the inner jQuery.get() doesn't get executed. Could some one help me out with this? jQuery(document).ready(function() { $('.error').hide(); $(".button").click(function() { // validate and process form here $('.error').hide(); var zipCode = $("input#name").va...