RcBuilder@walla.com
call centre: 054-5614020

jsonp – the basic

Posted by: RcBuilder  /   Category: AJAX / button / CROSS DOMAIN / Generic Handlers / HTML / HttpRequest / JAVASCRIPT / jQuery / JSON / onclick event / SOURCE CODE   /   No Comments
06
Oct
2014

jsonp - the basic SERVER string callback = string.Empty; if (context.Request.QueryString != null) callback = context.Request.QueryString.Trim(); if (callback == string.Empty) return; string json_data = ""; context.Response.Write(string.Concat(callback, "(", json_data, ");")); CLIENT <script src="JS/jquery-1.4.2.min.js" type="text/javascript"></script> <script type="text/javascript"> function JsonP_Callback(json_res) { alert(json_res); } function JsonP_Call() { $.ajax({ dataType: "jsonp", // jsonp type url: "JsonP.ashx", jsonp: "callback", // param name jsonpCallback: "JsonP_Callback" // callback function name }); } </script> HTML <input type="button" value="JsonP_Call" onclick="JsonP_Call()".

Read more

JSONP CROSS DOMAIN

Posted by: RcBuilder  /   Category: AJAX / CROSS DOMAIN / JAVASCRIPT / JSON   /   1 Comment
17
Jun
2014

JSONP CROSS DOMAIN * use 'Access-Control-Allow-Origin' header in order to define allow access to all or specific domains - to allow all domains context.Response.AddHeader("Access-Control-Allow-Origin", "*"); - to allow only specific domains context.Response.AddHeader("Access-Control-Allow-Origin", "http://domain1.com"); context.Response.AddHeader("Access-Control-Allow-Origin", "http://domain2.com"); context.Response.AddHeader("Access-Control-Allow-Origin", "http://domain3.com"); ---- * use 'Access-Control-Allow-Methods' header to define the methods to allow access to - context.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST"); ---- * use 'application/json' Content Type to return json or jsonp - context.Response.ContentType =.

Read more

JSON CROSS DOMAIN

Posted by: RcBuilder  /   Category: AJAX / CROSS DOMAIN / JAVASCRIPT / JSON   /   No Comments
17
Jun
2014

JSON CROSS DOMAIN * use 'Access-Control-Allow-Origin' header in order to define allow access to all or specific domains - to allow all domains context.Response.AddHeader("Access-Control-Allow-Origin", "*"); - to allow only specific domains context.Response.AddHeader("Access-Control-Allow-Origin", "http://domain1.com"); context.Response.AddHeader("Access-Control-Allow-Origin", "http://domain2.com"); context.Response.AddHeader("Access-Control-Allow-Origin", "http://domain3.com"); ---- * use 'Access-Control-Allow-Methods' header to define the methods to allow access to - context.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST"); ---- * use 'application/json' Content Type to return json or jsonp - context.Response.ContentType =.

Read more

AJAX CROSS DOMAIN

Posted by: RcBuilder  /   Category: AJAX / CROSS DOMAIN / JAVASCRIPT / JSON   /   No Comments
17
Jun
2014

AJAX CROSS DOMAIN * use 'Access-Control-Allow-Origin' header in order to define allow access to all or specific domains - to allow all domains context.Response.AddHeader("Access-Control-Allow-Origin", "*"); - to allow only specific domains context.Response.AddHeader("Access-Control-Allow-Origin", "http://domain1.com"); context.Response.AddHeader("Access-Control-Allow-Origin", "http://domain2.com"); context.Response.AddHeader("Access-Control-Allow-Origin", "http://domain3.com"); ---- * use 'Access-Control-Allow-Methods' header to define the methods to allow access to - context.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST"); ---- * internet explorers older version (less then 9) doesn't support the 'Access-Control-Allow-Origin'.

Read more
  • פיתוח מערכות
  • פתרונות טכנולוגים
  • קידום אתרים
  • בניית אתרים