Search Results

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

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

  • JSONP request using jquery $.getJSON not working on well formed JSON.

    - by Antti
    I'm not sure is it possible now from the url I am trying. Please see this url: http://www.heiaheia.com/voimakaksikko/stats.json It always serves the same padding function "voimakaksikkoStats". It is well formed JSON, but I have not been able to load it from remote server. Does it need some work from the server side or can it be loaded with javascript? I think the problems gotta to have something to with that callback function... JQuery is not requirement, but it would be nice. This (callback=voimakaksikkoStats) returns nothing (firebug - net - response), and alert doesn't fire: $.getJSON("http://www.heiaheia.com/voimakaksikko/stats.json?callback=voimakaksikkoStats", function(data){ alert(data); }) but this (callback=?): $.getJSON("http://www.heiaheia.com/voimakaksikko/stats.json?callback=?", function(data){ alert(data); }) returns: voimakaksikkoStats({"Top5Sports":[],"Top5Tests":{"8":"No-exercise ennuste","1":"Painoindeksi","2":"Vy\u00f6t\u00e4r\u00f6n ymp\u00e4rys","10":"Cooperin testi","4":"Etunojapunnerrus"},"Top5CitiesByTests":[],"Top5CitiesByExercises":[],"ExercisesLogged":0,"Top5CitiesByUsers":[""],"TestsTaken":22,"RegisteredUsers":1}); But I cannot access it... In both examples the alert never fires. Can someone help?

    Read the article

  • How to Generate Embeddable Widgets, and Return PartialView, JS & CSS as JSONP?

    - by DaveDev
    I found this question which is a great starting point towards creating embedded widgets that enable showing dynamic content on remote sites (i.e. a different domain). One problem I'm having is with the following code: public ActionResult SomeAction() { return new JsonpResult { Data = new { Widget = "some partial html for the widget" } }; } It says Widget = "some partial html for the widget" but this doesn't really mean anything to me. I assume that Widget would contain the HTML representing what the user wants to see on the screen, but How do I get the contents of my Partial View into Widget? Can anyone point me in the right direction? Thanks..

    Read the article

  • AJAX/JSONP Question. Access id denied using IE while requesting corss domain.

    - by Sisir
    Ok, Here we go. I have already searched the Stack for the answer i have found some useful info but i want to clear up some more things. I also search the net for the answer but no real help. I have worked with some api (yelp, ouside.in). In yelp i use to inject the script to head with the url request to the api with a callback funcion. I worked fine in all browsers. But while using outside.in api when i call the url the callback in not working. In yelp they have a url field can be used like that callback=callbackfuncion so the callback will automatically called. But in outside.in there is not such field available. Is there are any standard command for callback function which will work regardless of any server/api? I also tried a standard ajax request using jQuery $.ajax() function. It worked for my local pc for both IE and other browser but did not working in IE showing the error: access denied, other borwser seems ok. Firebug in my FF also don't notice any errors. Outside.in has an javascript example but it is too hard to me to understand github.com/outsidein/api-examples/tree/master/javascript/browser/ site i am working: http://citystir.com yelp: yelp.com outside.in: outside.in Techniqual info: i am using: wampserver in local, wordpress for hosting, Godaddy, apache for remote with linux. Codes: Using Jquery $.ajax url is like: "http://hyperlocal-api.outside.in/v1.1/states/Illinois/cities/chicago/stories?dev_key="+key+"&sig="+signeture+"&limit=3 function makeOutsideRequest(url){ $.ajax({ url: url, dataType: 'json', type: 'GET', success: function (data, status, xhr) { if (data == null) { alert("An error occurred connecting to " + url + ". Please ensure that the server is running and configured to allow cross-origin requests."); }else{ printHomeNews(data); } }, error: function (xhr, status, error) { alert("An error occurred - check the server log for a stack trace."); } }); } Thanks!

    Read the article

  • ajax response byte size

    - by Alex Pacurar
    Im using jQuery's getJSONP and I want to log the duration of the call and the size of the response to be able to have some statistics about the usage of my application. This is a cross domain ajax call, so I need to use JSONP, but as the JSONP call is not done with an XMLHttpRequest object, the complete callback from jquery's ajax doesnt pass the response content. So my question is how to get the response size (content lenght) from a JSONP call. $.ajaxSetup( { complete:function(x,e) { log(x.responseText.length, x.responseText); } } here x is a XMLHttpRequest object for a JSON call , but for JSONP call is undefined.

    Read the article

  • Using PUT/POST/DELETE with JSONP and jQuery

    - by ryanzec
    I am working on creating a RESTful API that supports cross-domain requests, JSON/JSONP support, and the main HTTP method (PUT/GET/POST/DELETE). Now while will be easy to accessing this API through server side code , it would nice to exposed it to javascript. From what I can tell, when doing a JSONP requests with jQuery, it only supports the GET method. Is there a way to do a JSONP request using POST/PUT/DELETE? Ideally I would like a way to do this from within jQuery (through a plugin if the core does not support this), but I will take a plain javascript solution too. Any links to working code or how to code it would be helpful, thanks.

    Read the article

  • Cannot complete a JSONP call from jQuery to WCF

    - by Dusda
    Okay, I am trying (poorly) to successfully make a JSONP call from jQuery on a test page to a WCF web service running locally, as a cross-domain call. I have, at one point or another, either gotten a 1012 URI denied error, gotten a response but in Xml, or just had no response at all. Currently, the way I have it configured it spits back a 1012. I did not write this web service, so it is entirely possible that I am just missing a configuration setting somewhere, but I've become so frustrated with it that I think just asking on here will be more productive. Thanks guys. Details below. I have a WCF web service with the following method: [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public decimal GetOrderStatusJson(int jobId) I am trying to call this method from a jQuery test page, via a cross-domain JSONP call. <script type="text/javascript"> getJsonAjaxObject( "http://localhost:3960/ProcessRequests.svc/json/GetOrderStatusJson", { "jobId": 232 }); function getJsonAjaxObject(webServiceUrl, jsonData) { var request = { type: "POST", contentType: "application/json; charset=utf-8", url: webServiceUrl, data: jsonData, dataType: "jsonp", success: function(msg) { //success! alert("blah"); }, error: function() { //oh nos alert("bad blah"); } }; $.ajax(request); } </script> Below are the chunks of the web.config I configure for this purpose: <services> <service behaviorConfiguration="MWProcessRequestWCF.ProcessRequestsBehavior" name="MWProcessRequestWCF.ProcessRequests"> <endpoint address="json" behaviorConfiguration="AspNetAjaxBehavior" binding="webHttpBinding" contract="MWProcessRequestWCF.IProcessRequests" /> <endpoint address="" binding="wsHttpBinding" contract="MWProcessRequestWCF.IProcessRequests"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MWProcessRequestWCF.ProcessRequestsBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="AspNetAjaxBehavior"> <enableWebScript/> </behavior> </endpointBehaviors> </behaviors>

    Read the article

  • Twitter Search API is returning weird characters - is it more or is it them?

    - by DanSingerman
    We are building an app that accesses the Twitter search over JSONP. It mostly works fine, but occasionally the request returns a JSONP callback that exists of weird unparseable characters. Here is an example: http://search.twitter.com/search.json?result_type=recent&rpp=100&geocode=51.4375857,-0.1658648,1km&page=5&callback=jsonp1272532482854 (If you change page=5 to a value less than 5 in the URL it works fine) So Am I doing something wrong? Can anyone suggest a workaround?

    Read the article

  • jsonp callback error and parserror

    - by Fatima Zahrae Abbadi
    im devlopping web app with javascript/html5 client side and im using web service rest in the server i want to get json data from the server and i have problem of cross domain and i use JSONP the problme that i had the callback was not called this is the code of REST @GET @Path("agenda") @Produces({MediaType.APPLICATION_JSON}) public List<AgendaChambre> getAgenda() { ArrayList<AgendaChambre>list=new ArrayList<>(); return agenda.findAll(); } and function getdata(){ $.ajax({ type: "GET", dataType:"jsonp", crossDomain: true, url: "http://localhost:8080/wsccm/res/ws/agenda?jsoncallback=?", data: {name: "George Koch"}, jsonpCallback: 'successCallback', success: function(data1) { getdata=JSON.stringify(data1); alert("bieeeeeeeeeeeeeeeeen"); console.log("response:" + getdata); }, error: function(jqXHR, textStatus, errorThrown) { alert('error'+errorThrown); console.log(jqXHR); } });

    Read the article

  • Any way to identify a redirect when using jQuery's $.ajax() or $.getScript() methods?

    - by Bungle
    Within my company's online application, we've set up a JSONP-based API that returns some data that is used by a bookmarklet I'm developing. Here is a quick test page I set up that hits the API URL using jQuery's $.ajax() method: http://troy.onespot.com/static/3915/index.html If you look at the requests using Firebug's "Net" tab (or the like), you'll see that what's happening is that the URL is requested successfully, but since our app redirects any unauthorized users to a login page, the login page is also requested by the browser and seemingly interpreted as JavaScript. This inevitably causes an exception since the login page is HTML, not JavaScript. Basically, I'm looking for any sort of hook to determine when the request results in a redirect - some way to determine if the URL resolved to a JSONP response (which will execute a method I've predefined in the bookmarklet script) or if it resulted in a redirect. I tried wrapping the $.ajax() method in a try {} catch(e) {} block, but that doesn't trap the exception, I'm assuming because the requests were successful, just not the parsing of the login page as JavaScript. Is there anywhere I could use a try {} catch(e) {} block, or any property of $.ajax() that might allow me to hone in on the exception or otherwise determine that I've been redirected? I actually doubt this is possible, since $.getScript() (or the equivalent setup of $.ajax()) just loads a script dynamically, and can't inspect the response headers since it's cross-domain and not truly AJAX: http://api.jquery.com/jQuery.getScript/ My alternative would be to just fire off the $.ajax() for a period of time until I either get the JSONP callback or don't, and in the latter case, assume the user is not logged in and prompt them to do so. I don't like that method, though, since it would result in a lot of unnecessary requests to the app server, and would also pile up the JavaScript exceptions in the meantime. Thanks for any suggestions!

    Read the article

  • Drupal JSON POST from PhoneGap

    - by abritez
    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 ideas would be helpful. Thanks! //SEND REQUEST AND CALLBACK FUNCTION var req; DrupalService.prototype.request = function(dataObject, callback){ req = false; var url = DRUPAL_JSON_URL; var params = "data="+dataObject; try { req = new XMLHttpRequest(); } catch(e) { req = false; } if(req) { req.onreadystatechange = function() {//Call a function when the state changes. if(req.readyState == 4 && req.status == 200) { console.log(" "+req.responseText); } } req.open("POST", url, false); req.send(params); } }

    Read the article

  • Cross Domain Scripting Issues & JSONP

    - by DaveDev
    Our Client requires that we supply Widgits for their site. They want to link to us to get Html & the jQuery required to manipulate the Html and do asynchronous requests. I understand that there are cross-domain security limitations that would prevent this from being a possibility, but that some of those limitations are aleviated by using JSONP as the data transfer format. I'm finding it difficult in finding an explanation of what's possible in the context of what I'm trying to achieve. Could somebody please fill me in?

    Read the article

  • Same Origin issue with web service call

    - by Wjdavis5
    My web server runs at http://mypc.com:80 ` Given the following snip: $(window).load(function () { var myURL = "http://mypc.com:8000/PSOCharts/service/HighChart_ColumnChart/i"; $.getJSON(myURL) .done(function(data) {alert(data);}); }); I am running to this error: XMLHttpRequest cannot load http://mypc.com:8000/PSOCharts/service/HighChart_ColumnChart/i. Origin http://mypc.com is not allowed by Access-Control-Allow-Origin. I understand why (I think) b/c my webservice runs at port 8000 which is different from what IIS is running on (port 80). I thought I could get around by using jsonp (according to the jQuery documentation here So I copied the example of making a call to the flickr api, but it isnt working. Any thoughts/sugggestions? UPDATE Ok so my request is being made now: var myURL = "http://192.168.1.104:8000/PSOCharts/service/HighChart_ColumnChart/i?jsoncallback=?"; $.ajax({ url :myURL, dataType: "jsonp", success: function(data) {a(data)} , error: function(){alert("err");}, }); But I am continually hitting the error function, here is what's being returned: [1.4,54.43,49.39,93.23] Now I'm assuming this is b/c the response text doesnt contain any type of callback here is the part of the interface I'm calling: [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "HighChart_ColumnChart/{id}?callback={cb}")] List<double> HighChart_ColumnChart(string id,string cb); Here is the actual function being called: public List<double> HighChart_ColumnChart(string id,string cb) { var z = new List<double>(); z.Add(1.4); z.Add(54.43); z.Add(49.39); z.Add(93.23); return z; } when I debug, the CB param is something like : "jQuery19108121746340766549_1372630643878". How do I modify the code to wrap it correctly? Thanks for the help thus far!

    Read the article

  • "invalid label" Firebug error with jQuery getJSON

    - by jerome
    Hi all, I'm making a jQuery getJSON request to another domain, so am making sure that my GET URI ends with "callback=?" (i.e. using JSONP). The NET panel shows that I am receiving the data as expected, but for some reason the Console logs the following error: "invalid label". The JSON validates with JSONLint so I doubt that there is anything truly wrong with the structure of the data. Any ideas why I might be receiving this error?

    Read the article

  • Ajax cross domain call

    - by jAndy
    Hi Folks, I know about ajax cross-domain policy. So I can't just call "http://www.google.com" over a ajax HTTP request and display the results somewhere on my site. I tried it with dataType "jsonp", that actually would work, but I get a syntax error (obviously because the received data is not json formated) Is there any other possiblity to receive/display data from a foreign domain ? iFrames follow the same policy? Kind Regards --Andy

    Read the article

  • How to make cross-domain AJAX calls to Google Maps API?

    - by Pedro
    Hi everyone, I'm trying to make a jQuery $.getJSON call to the Google Maps Geocoding webservice, but this doesn't work because of cross-domain security issues. I haven't been able to figure it out online, but I've read a bit about Google Javascript API or JSONP, but so far no clear answer... Could anyone enlight me? Thanks!

    Read the article

  • Can I use IP addresses to limit API access

    - by ed209
    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 to my API?

    Read the article

  • Json / Jsonp not connecting to php (Phonegap + jquerymobile)

    - by Madhulika Mukherjee
    I am trying to make - an android WEB application with phonegap layout with JqueryMobile What Im doing - An html form that takes ID, name, and address as input 'Serialize's this data using ajax makes a json object out of it Should send it to a file called 'connection.php' Where, this data is put into a database (MySql) Other details - My server is localhost, Im using xampp I have already created a database and table using phpmyadmin The problem - My html file, where my json object is created, does not connect to the php file which is hosted by my localhost Here is my COMPLETE html file: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <!-- Change this if you want to allow scaling --> <meta name="viewport" content="width=default-width; user-scalable=no" /> <meta http-equiv="Content-type" content="text/html;charset=utf-8"> <title>Trial app</title> <link rel="stylesheet" href="thestylesheet.css" type="text/css"> <script type="text/javascript" charset="utf-8" src="javascript1.js"></script> <script type="text/javascript" charset="utf-8" src="javascript2.js"></script> <script type="text/javascript" charset="utf-8" src="cordova-1.8.0.js"></script> <script> $(document).ready(function () { $("#btn").click( function() { alert('hello hello'); $.ajax({ url: "connection.php", type: "POST", data: { id: $('#id').val(), name: $('#name').val(), Address: $('#Address').val() }, datatype: "json", success: function (status) { if (status.success == false) { alert("Failure!"); } else { alert("Success!"); } } }); }); }); </script> </head> <body> <div data-role="header"> <h1>Heading of the app</h1> </div><!-- /header --> <div data-role="content"> <form id="target" method="post"> <label for="id"> <input type="text" id="id" placeholder="ID"> </label> <label for="name"> <input type="text" id="name" placeholder="Name"> </label> <label for="Address"> <input type="text" id="Address" placeholder="Address"> </label> <div id="btn" data-role="button" data-icon="star" data-theme="e">Add record</div> <!--<input type="submit" value="Add record" data-icon="star" data-theme="e"> --> </form> </div> </body> </html> And here is my 'connection.php' hosted by my localhost <?php header('Content-type: application/json'); $server = "localhost"; $username = "root"; $password = ""; $database = "jqueryex"; $con = mysql_connect($server, $username, $password); if($con) { echo "Connected to database!"; } else { echo "Could not connect!"; } //or die ("Could not connect: " . mysql_error()); mysql_select_db($database, $con); /* CREATE TABLE `sample` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(45) DEFAULT NULL, `Address` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) ) */ $id= json_decode($_POST['id']); $name = json_decode($_POST['name']); $Address = json_decode($_POST['Address']); $sql = "INSERT INTO sample (id, name, Address) "; $sql .= "VALUES ($id, '$name', '$Address')"; if (!mysql_query($sql, $con)) { die('Error: ' . mysql_error()); } else { echo "Comment added"; } mysql_close($con); ?> My doubts: No entry is made in my table 'sample' when i view it in phpmyadmin So obviously, i see no success messages either I dont get any errors, not from ajax and neither from the php file. Stuff Im suspecting: Should i be using jsonp instead of json? Im new to this. Is there a problem with my php file? Perhaps I need to include some more javascript files in my html file? I assume this is a very simple problem so please help me out! I think there is just some conceptual error, as i have only just started with jquery, ajax, and json. Thank you.

    Read the article

  • callback execution order in jQuery getJSON

    - by lau
    I'm trying to implement a iGoogle like dashboard interface using widgets that get their content from other sites using JSONP calls. The problem is that if the first widget that calls the "$.ajax" takes 8 seconds to get the content back, it seems that the callbacks of the other widgets will only be called after the callback of the first widget gets executed. For the user experience, it would be better if the widgets could be displayed as soon as they get the content back from the remote sites, and not wait for those that were scheduled before to complete. Is there a way I can do that?

    Read the article

  • Insert an ajaxified Webpart into an existing MOSS site

    - by mamoo
    Hi everybody, I need to code a webpart which purpose is to asynchronously fetch some documents and display them into an existing page. Unfortunately I have to face a lot of rescritcions and my struggle to find a solution seems useleess so far. 1) I cannot use Microsoft asp.net ajax 2) I must use Jsonp because the called service (page, whatever...) is outside the site's domain. That's not a big problem. 3) I have no possibility to alter the existing page code, so I cannot reference an external library such as JQuery. 4) For the same reason I have no possibility to call my methods on the window.onLoad event, so here the question is: how can I be sure that everything is correctly loaded before triggering my ajax call? 5) Since several instances of the same webpart can be placed into the same page, can there be some possible conflicts among the various js functions?

    Read the article

  • How do I create a random method name

    - by Russ Bradberry
    I plan on using JSONP to call an external webservice to get around the fact that I dont want to create a global function that could potentially conflict with the calling page. I thought that creating a random function name and passing it up would work. Something like this: <script src="www.foo.com/b?cb=d357534"> where cb is the callback function name, the server would return d357534({my json data}); what i want to know is how to create the random function name, im sure i could use eval but is this the best way to go about it? essentially, what i am trying to do is this: var d + Math.floor(Math.random()*1000001) = function(){...

    Read the article

  • Sending BLOBs in a JSON service,... how?

    - by Marten Sytema
    Hello I have a webservice (ie. servlet) implemented in Java. It gets some data from a MySQL table, with one column being of type BLOB (an image), and some other columns are just plain text. Normally I would store the file outside the database with a pointer to it in the database, but due to circumstance I now have to use this BLOB column... What is the proper way to send this? How to encode the image in a JSONObject, and how to parse (and RENDER!) it on the otherside ? I want to use JSONP, to avoid having to proxy it through the consumer's webserver. So that the consumer can just put in a tag pointing to the webservice, calling a callback. Any thoughts how to handle images in this situation? Also thoughts on performance etc. are interesting!

    Read the article

  • Accessing Remote ASP.NET Web Services' JSON data

    - by Emon
    How can I best create a webservice method which returns JSON data that is to be consumed by an application on a different domain? The following article talks about how to set it up: http://www.codeproject.com/KB/webservices/ASPNET_JSONP.aspx I havent tried it out yet but it seems like there are a lot of steps and the ajax client has to do some extra work. My question, is there a better way to do this? Also, I dont know too much about WCF services. Would I still have to go through a lot of work to enable JSONP? Thanks in advance.

    Read the article

  • How to store and access JSON data for a site?

    - by Callmeed
    I'm buiding an HTML/jQuery site where almost all the content comes from remote JSON data. I'm having trouble coming up with a good way to store and access the data in the future (scope-wise). Currently, I've written a jQuery plugin that gets the JSONP data when the site loads. But I have other functions and jQuery plugins that need to access this data. Where should this data be stored so other functions and plugins can access it? Should it be a global variable? If it matters, this site will only run on the iPad and the back-end of the site is in Rails.

    Read the article

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