How do I out put the JSON format for other website? I wrote the code below. I've tried to retrieve the information from the JSON server but it didn't return anything back.
JSON SERVER
<%@ Page Language="C#" %>
<%@ Import Namespace="System" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
//Response.ContentType = "application/json; charset=utf-8";
Response.ContentType = "application/x-javascript; charset=utf-8";
Response.AddHeader("Cache-Control", "no-cache");
//Response.Expires = 0;
// Response.AddHeader("content-disposition", "attachment;filename=" + Guid.NewGuid().ToString("N") + ".js");
}
</script>
({
'color': 'blue',
'animal': { 'dog': 'friendly' }
})
calling JSON SERVER
var testurl_a = "http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?"
var testurl_b = "http://www.xxxxxx.com/myaccount/jsonserver.aspx?tags=cat&tagmode=any&format=json&jsoncallback=?"
$.getJSON(testurl_b, function (data) {
alert("JSON Data from testurl_b"); //IS NOT WORKING
});
$.getJSON(testurl_a,function (data) {
alert("JSON Data from testurl_a Result--->>>"+ data.title); //IS WORKING
});