jsonp

WCF 4, JSONP, and jQuery cause parsererror

不想你离开。 提交于 2019-12-06 11:57:15
问题 I've tried nearly everything I can think of, but I'm still running into issues with my ajax calls to a WCF service. My WCF service has a method like below: //[WebInvoke(ResponseFormat = WebMessageFormat.Json, Method = "POST")] [WebGet] public string Test(int value) { return string.Format("You entered: {0}", value); } As mentioned on Twitter by Patrick Thomas, I've also tried using [WebGet(BodyStyle = WebMessageBodyStyle.Wrapped)] and [WebGet(BodyStyle = WebMessageBodyStyle.WrappedResponse)]

passing credentials not working

℡╲_俬逩灬. 提交于 2019-12-06 09:56:56
问题 I am trying to make a json call, by passing the credentials. If the user is already logged into the system using Sql Membership, how can I pass the credentials without getting this: Here is the code that calls the web.api: NOTE: call is being made from cross domain: i.e. www.project.com -> api.project.com var url = 'http://api.project.com/LookUps/uploadtypes?callback=?'; $.ajax({ type: 'GET', url: url, async: true, xhrFields: { withCredentials: true }, jsonpCallback: 'handler', contentType:

jasonp cross domain request “wrapping json into a callback method”

自作多情 提交于 2019-12-06 09:49:21
问题 I added ?callback=? to the url in the get request with an anonymous function, what do I have to add to my server side code to make it work cross domain. Is it right to use getJSON here? here is an example of the player without JSONP http://www.freeenergymedia.com/shared/PLAYER/player/player.php PHP script which returns JSON data <?php header('Access-Control-Allow-Origin: *'); $url = 'http://www.startalkradio.net/?page_id=354'; $rss = simplexml_load_file($url); $items = $rss->channel->item; $i

Cross domain request with header authentication

风格不统一 提交于 2019-12-06 09:00:56
问题 I need to send a Get request with cross domain origin with header authentication. Its working fine in Chrome and Firefox, but I'm having issues in Safari and IE. Also in random cases it returns 401. <script> var url = 'username:password@anotherdomain.com'; $.ajax({ url: url, dataType: 'jsonp', jsonpCallback: "callback", success: function(json) { alert(json); } }); </script> What would be the best option to solve this? 回答1: If I have understood the question correctly, you could use the

Jquery.ajax API request in JSON format causes “Uncaught SyntaxError: Unexpected token :” in Chrome

微笑、不失礼 提交于 2019-12-06 08:57:45
I am trying to query the http://developer.pintlabs.com/brewerydb/api-documentation with jquery.ajax. These are two of the Jquery requests i tried (note that "O3tmVI" is a dummy ID): $.ajax({ url:"http://api.playground.brewerydb.com/beer/" + "O3tmVI" + "?key=A1029384756B&format=json", dataType: "jsonp", jsonpCallback: "callbackfunctie", success:function(oData){ var returnData = oData; console.log(returnData); } }); And: $.getJSON("http://api.playground.brewerydb.com/beer/" + "O3tmVI" + "?key=A1029384756B&format=json&jsoncallback=?", function(data){ console.log(data); }); Both cause this error:

Copying cookies cross-domain, why is IE blocking cookies other browsers are sending with the SCRIPT tag

Deadly 提交于 2019-12-06 08:19:27
问题 Trying to copy a cookie from second.com to first.com, with full control of both domains. Previously an iFrame was used, however this is not able to work across all browsers as it touched on 'third-party cookies' which are hard to implement and impossible in Safari and Chrome. The new approach uses a SCRIPT tag pointing to second.com and included in the HEAD of first.com. The server-side script is actually a piece of Java which reads the cookies sent with the request (the cookies from second

Create a JSONP API in AngularJS & consume with jQuery

ぃ、小莉子 提交于 2019-12-06 07:49:33
问题 Right now I've created a JS API with JQuery, but I'm wondering if it could be done with AngularJs. For example, Imagine a small API like the following: var $myapi= $myapi|| {}; ;(function($, window, document, undefined){ _call_myapi_jsonp: function(params,controller,action,eventName){ if (!params) params = {}; var url = this.urls.base+"/"+controller+"/"+action+"?callback=?"; if (params.callback) url = this.urls.base+"/"+controller+"/"+action+"?callback="+params.callback; url = url + "&_"+new

How do I use jsonp with angular-ui calendar

岁酱吖の 提交于 2019-12-06 07:17:55
I'm using angular-ui calendar to try and pull events from my API. The API is on a separate domain so I have to use jsonp. I've tried various ways to get this working but can't get the events onto my calendar. I built a service to call the API angular.module('myapp.services', ['ngResource']) .factory( 'SurgerySource', ['$resource', function($resource){ return $resource( 'http://api.mydomain.com/calendar.json?callback=JSON_CALLBACK&start=:start&end=:end', {start:'@start', end:'@end'}, { jsonp_query: { method: 'JSONP', isArray: true } } ); }]); In the controller for my calendar I can call it

Where does the response get stored after a Dojo JSONP request?

孤者浪人 提交于 2019-12-06 06:06:08
问题 JavaScript For example, I have the following JavaScript code (Dojo 1.6 is already loaded): dojo.require("dojo.io.script") // PART I var jsonpArgs = { url: "http://myapp.appspot.com/query", content: { id: "1234", name: "Juan", start_date: "2000-01-01", callback: "recover" } }; // PART II dojo.io.script.get(jsonpArgs).then(function(data) { console.log(data); }); // PART III function recover(data) { console.log(data); } Direct query from browser I understand that my server will receive the query

WCF jsonP with Windows Authentication - Possible?

走远了吗. 提交于 2019-12-06 06:04:52
问题 I am hosting a wcf service which outputs jsonp. The response from IIS (with windows authentication turned on) is Cross domain javascript callback is not supported in authenticated services. Is there a way to work around this? I must have windows authentication turned on but would like to use wcf as well to server my jsonp My web config is as follows <system.serviceModel> <behaviors> <endpointBehaviors> <behavior name="webHttpBehavior"> <webHttp /> </behavior> </endpointBehaviors> </behaviors>