jsonp

implementing oData inlinecount using asp.net webapi [duplicate]

依然范特西╮ 提交于 2019-12-04 19:06:58
Possible Duplicate: OData pagination with WebApi ( $inlinecount ) Since Asp.net WebAPi almost supports odata, its very enticing for me to get $inlinecount to work so that it plays nicely with kendo ui ( or any other). So that it returns value in jsonp format, i implemented a new MediaFormatter ( from Stackoverflow). Trouble is that it needs the results to have count element in them in order to get server side paging to work, so for now i hacked the formatter to get a fake count to work. This all works great and the grid is all happy, however getting the real count is a challenge since

Angular: Custom headers are ignored by $http and $resource. Why?

梦想与她 提交于 2019-12-04 19:03:39
问题 I'm trying to access a REST service I don't control. First problem is that the service doesn't include a Access-Control-Allow-Origin header, which is a problem that, if I understand correctly, immediately limits me to JSONP. Also, by default, this service sends XML rather than JSON, though it's capable of sending JSON. I think it should respond to my Accept header, the people responsible for the service say it looks at my Content-Type. That would mean I'd need to do a POST rather than a GET

jsonp callback problem

我只是一个虾纸丫 提交于 2019-12-04 18:09:03
i'm trying the following code to retrieve the client ip, and it works fine <script type="text/javascript"> function getip(json) { var ip = json.ip; // alerts the client ip address alert(ip); } </script> <script type="text/javascript" src="http://jsonip.appspot.com/?callback=getip"></script> but when i try it with $.ajax it does nothing... $.ajax({ type: "GET", url: 'http://jsonip.appspot.com/?callback=getip', dataType: "jsonp", success: function getip(json) { alert("sucess"); var ip = json.ip; alert(ip); } }); }); plz help $.ajax({ type: "GET", url: "http://jsonip.appspot.com/?callback=?", //

WCF 4, JSONP, and jQuery cause parsererror

六眼飞鱼酱① 提交于 2019-12-04 18:02:25
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)] with no luck. And configuration like so: <system.serviceModel> <behaviors> <serviceBehaviors> <behavior

Why does “3 [1, 2];” return undefined in JavaScript?

…衆ロ難τιáo~ 提交于 2019-12-04 16:26:54
问题 I was looking at some of the AJAX calls that GMail does, and I noticed that sometimes the return value of the calls started with a number. Example: (note that there's is no semi-colon after the first line) 3 [1, 2]; If I were to enter this into a JavaScript console, I'd get undefined returned back. However, if the second parameter is a number or a string, I'd get the second parameter returned back. Example: 3 4 Returns 4. My guess is that they're doing this to stop jsonp-type attacks, however

How to use @RequestBody with a JSONP request?

左心房为你撑大大i 提交于 2019-12-04 15:37:30
I am trying to perform an ajax request using the jsonp data type due to cross domain issues in a clustered environment. I can make jsonp requests to methods mapped with no @RequestBody parameters, but when I do try to implement a RequestMapping with a @RequestBody parameter I get a 415 Unsupported Media Type error. Usually when I get this problem it is due to some property not mapping correctly between the json object posted and the Java object it is mapped to in Spring. But the only discrepency I can find is that using jsonp it adds a parm named callback and one with the name of an underscore

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

社会主义新天地 提交于 2019-12-04 15:36:42
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 = 0; $data = array(); foreach ($items as $item) { $data[] = array( 'title' => (string) $item->title,

passing credentials not working

本秂侑毒 提交于 2019-12-04 15:01:47
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: "application/javascript", dataType: 'jsonp', success: function (json, textStatus, jqxhr) { console.log

How to make an ajax with JQuery with cross site scripting?

与世无争的帅哥 提交于 2019-12-04 15:00:55
i'm with a problem that i have to get the json from here: http://templodasdeusas.com.br/game/srv/game.php?srv=home there is an option too to add callback function name like: http://templodasdeusas.com.br/game/srv/game.php?srv=home&callback=myFunction that will return something like: myFunction({'msgd':'value'}) ; i want to make um ajax request using jQuery, is that possible? i still receiving error with the normal $.ajax request, i was told that i must use jsonp or cross site scripting... how it works? someone got an exemple? tnx!! jQuery does this transparently for you, if you put callback=?

jQuery + JSONP + Yahoo Query Language

谁都会走 提交于 2019-12-04 14:49:25
问题 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 Yahoo Query Language which returns results as JSONP and also mangae to consume other webservices and return me the results. This is also working, here is an