I've been facing a tough situation working all day :(. Any help would be greatly appreciated.
My website needs to use the $http provider to call a ColdFusion file from another domain. Let's assume the link to the cfm file is:
http://xample.com/getStockCodesTest.cfm
This is an example of a ColdFusion file:
<cfcontent
type="application/json"
/>
{
"items": [
{
"StockCode" : { "col": "Stock Code", "value": "0231" },
"Qty" : { "col": "Qty", "value": "DS" },
"QtyOn" : { "col": "Qty On", "value": "Branch" },
"QtyVal" : { "col": "Qty Val", "value": "200" },
"ReleasedDate" : { "col": "Released Date", "value": "0" },
"S" : { "col": "S", "value": "0" },
"Description" : { "col": "Description", "value": "adfasdf" },
}
]
}
This is the angular code (written in coffeescript)
ajax = $http {
url: 'http://xample.com/getStockCodesTest.cfm'
method: 'JSONP'
params: {
callback: "JSON_CALLBACK"
}
}
ajax.success (data, status, headers, config) ->
console.log data
However, when checking Firebug, it always returns an error:
So, what is the correct way to write a test ColdFusion with content json like that and use AngularJS to capture it on my website :(