Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.ajax({
- type: "post",
- url: 'http://' + ip + '/Home/Test',
- dataType: 'json',
- data: { Email: email, Password: password, LogIn: true, DeviceID: client_device, OS: OS_Version },
- success: function (data) {
- if (data.msg === "1") {
- }
- }
- })
- <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
- <httpProtocol>
- <customHeaders>
- <add name="Access-Control-Allow-Origin" value="*" />
- <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS"/>
- <add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />
- </customHeaders>
- </httpProtocol>
- [AllowAnonymous]
- public JsonResult LogIn(LogInViewModel User)
- { ........
- public class JsonpResult : JsonResult
- {
- object data = null;
- public JsonpResult()
- {
- }
- public JsonpResult(object data)
- {
- this.data = data;
- }
- public override void ExecuteResult(ControllerContext controllerContext)
- {
- if (controllerContext != null)
- {
- HttpResponseBase Response = controllerContext.HttpContext.Response;
- HttpRequestBase Request = controllerContext.HttpContext.Request;
- string callbackfunction = Request["callback"];
- if (string.IsNullOrEmpty(callbackfunction))
- {
- throw new Exception("Callback function name must be provided in the request!");
- }
- Response.ContentType = "application/x-javascript";
- if (data != null)
- {
- JavaScriptSerializer serializer = new JavaScriptSerializer();
- Response.Write(string.Format("{0}({1});", callbackfunction, serializer.Serialize(data)));
- }
- }
- }
- }
- $.ajax({
- type: "post",
- url: 'http://' + ip + '/Home/LogIn',
- jsonp: "callback",
- dataType: 'jsonp',
- data: { Email: email, Password: password, LogIn: true, DeviceID: client_device, OS: OS_Version },
- success: function (data) {
- if (data.msg === "1") {
- window.localStorage["email"] = email;
- window.localStorage["sessionid"] = data.sessionid;
- .................
Add Comment
Please, Sign In to add comment