Search Results

Search found 186 results on 8 pages for 'jsonp'.

Page 2/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • JSONP not firing on IPad

    - by Gemtag
    After trying everything possible I've come to the conclusion this is an issue with IPad Safari. This works in FF, IE, Chrome, and Safari on MacBook. Below is my dumbed-down code. I have 2 separate JSONP calls, This first one works in all browsers including IPad. This simply calls a function based on a blur event $('#gender').blur(function() { reTarget(); }); function reTarget() { $.getJSON("http://host.com/Jsonpgm?jsoncallback=?", function() { } ); } Below is where things break. On the same page as the above code is the following, which calls a function based on a submit button click. $(':submit').bind('click', function(event) { if (checkThis() == false) { return false; }; }); $('form').bind('submit', function(event) { if (checkThis() == false) { return false; }; }); function checkThis() { $.getJSON("http://host.com/Jsonpgm.aspx?jsoncallback=?", function() { } ); } This code will not fire. I've put alerts right before it and they fire. I look at the web logs and there is no entry for this json call. I would take any suggestions on this. At this point I fear it's a problem with firing jsonp from a submit event.

    Read the article

  • Post data to JsonP

    - by Christo Fur
    Hi Is it possible to post data to JsonP? Or does all data have to be passed in the querystring as a GET request? I have alot of data that I need to send to the service, cross doamin, and it is too large to send via the querystring What are the options for getting around this? thanks

    Read the article

  • jQuery/JSONP widget and jquery version conflict

    - by geraud
    I would like to create a widget so that my visitors can display it on their blog/website. I would like to use jquery and jsonp to develop this widget. I know how to avoid conflicts between jQuery and other libraries (like prototype). But what will happen if jquery is already installed on my visitors' websites and if their version is different from my version ? What I mean is: what if, for example, they run a script using an older jquery version and which is not compatible with my jquery library ? Does it stop working ? Is their any workaround ?

    Read the article

  • JSONP callback method is not defined

    - by Micah
    I'm trying to get a jsonp callback working using jquery within a greasemonkey script. Here's my jquery: $.ajax({ url: "http://mydomain.com/MyWebService?callback=?", data: { authkey: "temphash" }, type: "get", dataType: "json", cache: false, success: function(data) { console.log(data); } }); in my webservice (asp.net) I'm returning the response with a content type of application/javascript. The response the server is actually sending back is: jsonp1276109314602({"message":"I'm getting tired of this not working"}) The jsonp1276109314602 method name is being randomly generated by jquery, and I'm grabbing it with Request.QueryString["callback"] However my success function is never called and the firebug console gives me an error saying jsonp1276109314602 is not defined. What am I doing wrong?

    Read the article

  • Bing search API using Jsonp not working, invalid label

    - by Blankman
    Struggling with Bing's json request (bing search, not map), I am getting an error back that says 'Invalid Label' My query url is: var bingurl="http://api.search.live.net/json.aspx?Appid=##APIKEY##&query=Honda&sources=web"; $.ajax({ type: "GET", url: bingurl, data: "{}", contentType: "application/json; charset=utf-8", dataType: "jsonp", success: function(data) { $callBack(data); }, error: function(msg) { alert("error" + msg); } }); Firebug reports 'invalid label' and then dumps the json response. No idea what is wrong? help appreciated.

    Read the article

  • is JsonP working with Opera, Chrome & Safari ?

    - by Tom
    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", url: "http://someurl.com", data: aRequestData, cache: false, error: function (XMLHttpRequest, textStatus, errorThrown) { // typically only one of textStatus or errorThrown // will have info alert("Error occured textStatus=" + textStatus + " errorThrown=" + errorThrown); }, success: function(data) { alert('success'); } }); Plain and simple and it works in browser window, however, to my big surprise it did not work in chrome, safari & opera, never got to the success alert. Does anyone know how to solve this issue? Thanks.

    Read the article

  • JSONP parsing error from WCF

    - by user1754730
    Answered my own question I had a problem with a jquery (jsonp) call to a WCF service that was throwing a json parsing error. Using ASP.NET 4.0 on the WCF side and jquery 1.7 on the client side. Turned out there was an old set of script tags on the page using language = VBSCRIPT. The browser was interpreting the returned json packet of script as "VBscript" instead of javascript. I placed a set of empty javascript tags at the top of the page and the browser is now interpreting the json as the proper javascript function. Hope this helps someone else. Tom

    Read the article

  • jquery $.ajax call succeeds but returns nothing. (jsonp)

    - by Shawn
    $(document).ready(function() { $('#button').click(function() { try { var json = $.ajax({url : 'http://www.example.com/experimental/service.php', type : 'jsonp', success : function() {alert('success')}}); alert(json); } catch(err) { alert(err.description) } var sjson = JSON.stringify(json); $('#display').html(sjson); }) }) After a button is pressed I get an alert message that says "success" and also one that says undefined, referring to the fact that nothing was returned from the ajax call. I checked the firebug 'net' tab and indeed i get a succesful response from the server of "jsonp1272724228884( {} );" Any ideas?

    Read the article

  • JSON / JSONP in JQuery

    - by dotnetgeek
    Hello. I am trying to figure out why my $.getJSON method does not seem to be working but the $.ajax works just fine. First, here is my getJSON call: $.getJSON("http://localhost:1505/getServiceImageList?callback=loadImagesInSelect", loadImagesInSelect); You can see I have tried added the callback parameter directly to the query string (also tried it not on string) and I added a reference to the callback method defined in my js file. Here is the $.ajax call which works just fine: function getImages() { $.ajax({ type: "GET", url: $('#txt_registry_url').val(), dataType: "jsonp", success:loadImagesInSelect , error:function (xhr, ajaxOptions, thrownError) { alert(xhr.status); alert(thrownError); } }); } In this example the url pulled from the text box is the same as in the straight call to getJSON. When the method call completes, the successMethod is called and everything processes just fine. While I am cool with using the later of the two methods, the docs make it seem that the getJSON is the preferred shorthand way of doing things. Can anyone please explain what I am missing on the shorthand method to make it all work? Thanks in advance.

    Read the article

  • JSONP context problem

    - by PoweRoy
    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 = { construct: function() { return this; }, preSuggest: function() { this.CreateJSONPRequest(this.suggest_url + "foo"); }, CreateJSONPRequest: function(url) { var headID = document.getElementsByTagName("head")[0]; var newScript = document.createElement('script'); newScript.type = 'text/javascript'; newScript.src = url +'&callback=autosuggest.prototype.JSONCallback'; //newScript.async = true; newScript.onload = newScript.onreadystatechange = function() { if (newScript.readyState === "loaded" || newScript.readyState === "complete") { //remove it again newScript.onload = newScript.onreadystatechange = null; if (newScript && newScript.parentNode) { newScript.parentNode.removeChild(newScript); } } } headID.appendChild(newScript); }, JSONCallback: function(data) { if(data) { this.keywords = data; this.suggest(); } }, suggest: function() { //use this.keywords } }; //Add suggestion box to textboxes window.opera.addEventListener('AfterEvent.load', function (e) { var textboxes = document.getElementsByTagName('input'); for (var i = 0; i < textboxes.length; i++) { var tb = textboxes[i]; if (tb.type == 'text') { if (tb.autocomplete == undefined || tb.autocomplete == '' || tb.autocomplete == 'on') { //we handle autosuggestion tb.setAttribute('autocomplete','off'); var obj1 = new autosuggest("http://test.php?q="); } } } }, false); I removed not relevant code. Now when 'preSuggest' is called, it add a script to the header and circumvent the crossdomain problem. Now when the data is received back 'JSONcallback' is called. I can use the data, but when 'Suggest' is I can't use the this.keywords array or this.suggest_url. I think this is because 'JSONcallback' and 'Suggest' are called in a different context. How can I get this working?

    Read the article

  • javascript JSONP callback function not defined

    - by bitsMix
    ( function restoreURL() { function turnLongURL(data) { window.location = data.url; } var shortUrl = window.location.href; var url = "http://json-longurl.appspot.com/?url=" + shortUrl + "&callback=turnLongURL"; var script = document.createElement('script'); script.setAttribute('src', url); document.getElementsByTagName('head')[0].appendChild(script); })(); code is above, but the firebug told me, turnLongURL is not defined why is that?

    Read the article

  • jquery, jsonp and no success

    - by Damo
    Hi I have the following jquery in my code$j.getJSON("http://localhost:8080/WWTestHarnessWEB/ReadersToolkitFinalController.htm?jsoncallback=?", {'uID': 1}, function(data){alert(data);}); The json that i am returning looks like the following ({"positiveCount":"0","negativeCount":"999"}) But my alert is never firing. Any idea what i need to do to ensure that this will work? regards Damien

    Read the article

  • how to kill an older jsonp request?

    - by pfg
    I have a cross-domain long polling request using getJSON with a callback that looks something like this: $.getJSON("http://long-polling.com/some.fcgi?jsoncallback=?" function(data){ if(data.items[0].rval == 1) { // update data in page } }); The problem is the request to the long-polling service might take a while to return, and another getJSON request might be made in the meantime and update the page even though it is a stale response. Req1: h**p://long-polling.com/some.fcgi at 10:00 AM Req2: h**p://long-polling.com/some.fcgi? at 10:01 AM Req1 returns and updates the data on the page 10:02 AM I want a way to invalidate the return from Req1 if Req2 has already been made. Thanks!

    Read the article

  • How can I get jsonp to play nice with my class?

    - by George Edison
    This whole jsonp thing is quite confusing... Here is what I want to do: I have a class DataRetriever The class has a method GetData GetData makes a jsonp request with the following code: var new_tag = document.createElement('script'); new_tag.type = 'text/javascript'; new_tag.src = 'http://somesite.com/somemethod?somedata'; // Add the element var bodyRef = document.getElementsByTagName("body").item(0); bodyRef.appendChild(new_tag); Now, the jsonp data from the server somesite.com can call a function in my code with the data. The problem is, how does the data get delivered to the instance of DataRetriever that requested it? I'm really stuck here.

    Read the article

  • Is it possible to use JSONP on the server?

    - by Denis Hoctor
    Hi all, I'm stuck on a clients host that has medium trust setup which blocks cross domain requests and need data from a 3rd party domain. I now have the option to use JSONP. I've used JSONP from the client with jQuery to get around the browsers cross domain security and I've used HttpWebRequest in ASP.Net 3.5. Is it possible to use JSON on the server and if so how? I don't think it is, but worth asking seeing as I already have this app written server side.... Thanks, Denis

    Read the article

  • How can I use JSONP to download client-side javascript objects?

    - by Alex Mcp
    I'm trying to get client-side javascript objects saved as a file locally. I'm not sure if this is possible. The basic architecture is this: Ping an external API to get back a JSON object Work client-side with that object, and eventually have a "download me" link This link sends the data to my server, which processes it and sends it back with a mime type application/json, which (should) prompt the user to download the file locally. Right now here are my pieces: Server Side Code <?php $data = array('zero', 'one', 'two', 'testing the encoding'); $json = json_encode($data); //$json = json_encode($_GET['']); //eventually I'll encode their data, but I'm testing header("Content-type: application/json"); header('Content-Disposition: attachment; filename="backup.json"'); echo $_GET['callback'] . ' (' . $json . ');'; ?> Relevant Client Side Code $("#download").click(function(){ var json = JSON.stringify(collection); //serializes their object $.ajax({ type: "GET", url: "http://www.myURL.com/api.php?callback=?", //this is the above script dataType: "jsonp", contentType: 'jsonp', data: json, success: function(data){ console.log( "Data Received: " + data[3] ); } }); return false; }); Right now when I visit the api.php site with Firefox, it prompts a download of download.json and that results in this text file, as expected: (["zero","one","two","testing the encoding"]); And when I click #download to run the AJAX call, it logs in Firebug Data Received: testing the encoding which is almost what I'd expect. I'm receiving the JSON string and serializing it, which is great. I'm missing two things: The Actual Questions What do I need to do to get the same prompt-to-download behavior that I get when I visit the page in a browser (much simpler) How do I access, server-side, the json object being sent to the server to serialize it? I don't know what index it is in the GET array (silly, I know, but I've tried almost everything)

    Read the article

  • Do I need to sanitize the callback parameter from a JSONP call?

    - by christian studer
    I would like to offer a webservice via JSONP and was wondering, if I need to sanitize the value from the callback parameter. My current server side script looks like this currently (More or less. Code is in PHP, but could be anything really.): header("Content-type: application/javascript"); echo $_GET['callback'] . '(' . json_encode($data) . ')'; This is a classic XSS-vulnerability. If I need to sanitize it, then how? I was unable to find enough information about what might be allowed callback strings.

    Read the article

  • Is there an existing tool for jsonp like fetching of xml in jquery?

    - by BearCode
    Hi, For a web service I'm developing I would like my embedded code (on the client's site) to fetch an xml file from my sever script which resides on my domain. As this is a cross-domain request I figured to use jsonp as it seems the de facto standard for such apis. However, for my application it would be easier for me to use xml instead of json. Now, I could of course convert my xml to json on the server and then back again to xml in the client's site javascript, but that seems unnecessarily cumbersome. What I really need is and xmlp solution, xml with padding. I tired googling but couldn't find a jquery plug-in that does that. Anyone knows a simple solution?

    Read the article

  • What's the pattern for a JSONP method that was initiated from a jQuery plugin?

    - by michielvoo
    I'm writing a jQuery plugin to render data retrieved from another domain in an element on the page. I follow the typical pattern for my jQuery plugin: $(selector).Plugin(options); In the plugin I get external data using jQuery.getScript(url, [success]). The external data source allows me to define the name of a method and it will wrap the data in a call to that method (JSONP): $.getScript("http://www.example.com/data?callback=global_callback", instance_callback); This effectively results in: <script type="text/javascript"> global_callback(data); </script> The scope of global_callback limits what the Plugin instance can do with the data. And the global_callback method has no knowledge of the selector or options that the plugin was instantiated with. I was thinking that global_callback would just store the data, and the plugin would retrieve the data in instance_callback. But I need to make sure that instance_callback will retrieve the correct data, I foresee a problem with multiple instances of the Plugin. How can I handle this? Thanks!

    Read the article

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

    - by Kent Brewster
    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...</p> <script type="text/javascript"> function ping(r) { alert('API reply: ' + r.catalog_title.title.regular); } var cb = new Date().getTime(); var s = document.createElement('SCRIPT'); s.src = 'http://movi.es/7Soq?v=2.0&output=json&expand=widget&callback=ping&cacheBuster=' + cb; alert('SCRIPT src: ' + s.src); s.type = 'text/javascript'; document.getElementsByTagName('BODY')[0].appendChild(s); </script> </body> </html> ... and here's the contents of my manifest, main.manifest, which contains no files and is only there so my browser knows to cache the calling HTML file. CACHE MANIFEST Yes, I've confirmed that my server is sending the manifest down with the correct content type, text/cache-manifest. The app works fine--meaning both alerts show--the first time I run it, but subsequent runs, even with the attempt at cache-busting in line 10, seem to be attempting to load the script from cache no matter what the query string is. I see the alert showing the script source, but the callback never fires. If I remove the manifest link from line 2 and reset my browser--being Safari and the iPhone Simulator--to clear cache, it works every time. I've also tried alerting the number of SCRIPT tags in the page, and it's definitely seeing both the existing and dynamically-created tag in all cases.

    Read the article

  • Netflix, jQuery, JSONP, and OData

    - by Latest Microsoft Blogs
    At the last MIX conference, Netflix announced that they are exposing their catalog of movie information using the OData protocol. This is great news! This means that you can take advantage of all of the advanced OData querying features against a live Read More......(read more)

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >