jsonp

jQuery-JSONP plugin fails when placed in a directory

I have an HTML page that uses the JSONP Plugin to gracefully handle errors in my JSONP call. My problem is quite perplexing (and I hope it has a simple, easy "D'Oh!" solution :)). When the .js file is in the same directory as the HTML page and is loaded like this: <script type="text/javascript" src="jquery.jsonp.min.js"></script> All ...

Can I use a static (i.e., predetermined) callback function name when requesting JSONP with jQuery?

The jQuery documentation lists the following example of using $.getJSON to request JSONP: $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&amp;tagmode=any&amp;format=json&amp;jsoncallback=?", function(data) { $.each(data.items, function(i,item) { $("<img/>").attr("src", item.media.m).appendTo("#imag...

How do I make a JSONP call with JQuery with Basic Authentication?

Using JQuery, how would I call a JSONP API that required basic authentication? Can I programatically handle this, or does the user have to interact and enter the username and password into the logon dialog? ...

JavaScript: How do I create JSONP?

I have a two domains, example1.com and example2.com From example1.com, I would like call a JSON API I have on example2.com. Knowing that this is not allowed, it occurred to me - this is exactly why JSON**P** was created. Question is, how do I modify my JSON API to make it JSONP capable? Basically, how do I create the callback api? UP...

Grails: JSONP callback without id and class in JSON file

Hi, I am working on a REST based interface where people get a json file. The client needs to access the file from another Domain. I use jsonp which works so far. My problem is the rendering in Grails. At the moment I use the 'as JSON' to marshalling the object: render "${params.jsoncallback}(${user as JSON})" The Json file getting to...

JSONP with Rails

I'm trying to retrieve JSON data from a remote site with Rails/Prototype. I've found that there's a branch of Prototype that has an Ajax.JSONRequest() function. I can't get this to work. jQuery has a $.getJSON() function, but I'm using some Prototype functions and I'd rather not switch to jQuery or use no conflict mode. What am I miss...

Error handling in getJSON calls

How can you handle errors in a getJSON call? Im trying to reference a cross-domain script service using jsonp, how do you register an error method? ...

JSONP + onbeforeunload + back button + problems

Hi All, I am trying to make a JSONP call to a server on the 'beforeunload' event. This all works great until I start playing with the back button. If I navagate away from the page and then press 'back' next time the beforeunload event gets called it appears to make the JSONP request but the server never receives it. Note(1): This ha...

Drupal node.save and JSONP

I am having an issue with call Drupal node.save using MooTool's JSONP. Here is an example. Here is my request: callback Request.JSONP.request_map.request_1 method node.save sessid 123123123123123 node {"type":"blog","title":"New Title","body":"This is the blog body"} Here is my result HTTP/1.0 500 Internal Server Error I got this wo...

XML cannot be the whole program

I am using jquery to make an $.ajax() call to a REST web service. Based on the documentation I found, I need to use jsonp as the datatype in order to make this cross domain call (an XML document is what is actually returned). When running my code, however, I receive the error "XML cannot be the whole program". Does anyone know what this...

JSONP & http://localhost.:<port>/

After reading http://stackoverflow.com/questions/1217926/jsonp-callback-doesnt-execute-when-running-at-localhost and googling a lot, I am still unclear if there is a potential XSS security threat. Is this "hole" covered in popular browsers nowadays? (notice the dot in the URI) ...

Drupal JSON POST from PhoneGap

I am trying to send a POST request to Drupal's Services module & JSON_Server module, however I am getting { "#error": true, "#data": "Invalid method " } Since PhoneGap runs html files from locally on the phone, should i need to worry about JSONP. The issue I have with that is that I must POST data, and JSONP only allows for GET. Any i...

with jQuery, access json from cross domain url where json may be poorly formed

I'm using jQuery's ajax function to hit a cross domain url. The url will return json. I'm in the discovery phase with this but I think, because the json values contain several '&quot' strings, the json eval is throwing an error and stopping the execution of my client side script. The error that I get is "unterminated string literal". I k...

Why same origin policy for XMLHttpRequest

Why do browsers apply the same origin policy to XMLHttpRequest? It's really inconvenient for developers, but it appears it does little in actually stopping hackers. They are workarounds, they can still include javascript from outside sources (the power behind JSONP). It seems like an outdated "feature" in a web that's largely interlinke...

jQuery "getJSON" from an external domain that doesn't support JSON-P output.

Hello, I'm trying to grab data from a JSON on an external site but the site doesn't support JSON-P output. This is an example of non-working code, but gives a good idea of what I'm trying to achieve: $.getJSON("http://www.bom.gov.au/fwo/IDV60901/IDV60901.94868.json", function(data){ //Process data here }); Are there ways around t...

is JsonP working with Opera, Chrome & Safari ?

Hi, On a web site that I am building , when you log in (because the database is on an other server), I use json padding to check if the user as the right credentials. It's working flawlessly (ie7,ie8 & FF), until I tried it on chrome, safari & opera where it's a complete disaster. $.ajax({ type: "GET", dataType: "jsonp", u...

How to Post using JSON and JQuery from a form?

I'm using jQuery and the CloudKit/Tokyo Cabinet backend from an HTML page. All calls are REST/JSON so the server needs JSON data posted. How do I turn the form into JSON and post it? JQuery seems to have a type for JSON return values but not to send JSON. Any ideas? IS it different if it's cross domain? Alex ...

How do I avoid having JSONP returns cached in an HTML5 offline application?

I had good luck with cached offline apps until I tried including data from JSONP endpoints. Here's a tiny example, which loads a single movie from the new Netflix widget API: <!DOCTYPE html> <html manifest="main.manifest"> <head> <title>Testing!</title> </head> <body> <p>Attempting to recover a title from Netflix now.....

The type [nameHere] registered for extension '[extensionHere]' could not be loaded. - C#/WCF/JSONP

I've been learning and building JSONP Web services using WCF on fx3.5. You can read some of the trials I had at http://stackoverflow.com/questions/1903022/net-asmx-returning-pure-json. I finally got a sample running but now I am I am dove tailing it into my app. RivWorks.Web - the web site - located at http://dev.rivworks.com RivWorks...

Posting cross-domain JSON to ASP.NET with jQuery

Got kind of a tricky problem. I'm working on a project where we need to allow receipt printouts when users check out on our site at a kiosk. For reasons relating to drivers and formatting, I am using COM automation with Word to handle printing out the receipts. I've wrapped this code up in a web service that runs on a local machine. Th...