Ahjesus enables my MVC web API to support JsonP cross-origin and ahjesusjsonp

Source: Internet
Author: User

Ahjesus enables my MVC web API to support JsonP cross-origin and ahjesusjsonp

Numerous people who encounter a successful request but cannot access success always prompt parsererror. Refer to the two articles.

Reference http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api

And

Http://diaosbook.com/Post/2013/12/27/tips-for-aspnet-webapi-cors


Does the jsonp data returned from cross-origin need to be provided to the callback function?

The backend only needs to return a string of Data copied by this function name (json name). The reason why the domain name json is a kind of data name seems to be a bit understandable, json is a type of data name. It does not support cross-domain data. The p of jsonp indicates filling, which means filling a function in front of json data and executing it using the script tag, in order to achieve the effect of cross-origin is not beautiful, is that true? Cross-origin means that you are not allowed to obtain the data name is not affected, of course, the misappropriation will define the jsonxxx function jsonp because the js script is loaded without cross-origin, so you do not need to use ajax to use a script tag through the process his src visit the ghost website background This src will add a jsonp = jsonpxxx parameters to identify the misappropriation of function name

Js required for cross-origin access to ajax jsonp in Extjs

<Script type = "text/javascript" src = "Ext/adapter/ext/ext-base.js"> </script>
<Script type = "text/javascript" src = "ext/ ext-all.js"> </script>
<Script type = "text/javascript" src = "/ext/ ext-basex.js"> </script>
Just add the three.

It is best to add <script type = "text/javascript" src = "/Ext/src/locale/ext-lang-zh_CN.js"> </script>
Avoid gibberish

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.