JavaScript Correct way to write ColdFusion service to send json data and catch by angularjs

I'm Very stuck in this case when working all day :(. please help me.

I have website need using $http provider to call ColdFusion file from other domain. let's say this is link to cfm file : http://xample.com/getStockCodesTest.cfm


this is may sample 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 angular code (i use coffeescript to write)

ajax = $http {
        url: 'http://xample.com/getStockCodesTest.cfm'
        method: 'JSONP'
        params: {
            callback: "JSON_CALLBACK"
        }
    }
    ajax.success (data, status, headers, config) ->
        console.log data

but when check firebug. it always return error:

enter image description here

so how can i have a correct way to write a test ColdFusion with content json like that and use angularjs to catch in to my web :(

Answer:1

I'm not exactly sure what you are asking. But I can tell you that you are getting the error because you have invalid JSON.

enter image description here

That comma, right there, remove it. It makes for invalid JSON.

Answer:2

How to break sequence of handlers of Promises/A? For example if we have sequence: method1().then(method2()) .then(method3(), errorHandler3()); and in method2() we decided to break ...

How to break sequence of handlers of Promises/A? For example if we have sequence: method1().then(method2()) .then(method3(), errorHandler3()); and in method2() we decided to break ...

I am working with file-picker. from front-end side user is filling a form and uploading files in it, which are stored using file-picker. on submit of users form I have to send him acknowledgement ...

I am working with file-picker. from front-end side user is filling a form and uploading files in it, which are stored using file-picker. on submit of users form I have to send him acknowledgement ...

I would like to check how many words in a string eg. asdsd sdsds sdds 3 words The problem is , if there is more than one space between two substring , the result is not correct here is my ...

I would like to check how many words in a string eg. asdsd sdsds sdds 3 words The problem is , if there is more than one space between two substring , the result is not correct here is my ...

  1. check string contains
  2. check string contain php
  3. check string contain python
  4. check string contain javascript
  5. check string contain c#
  6. check string contains substring python
  7. check string contain character in java
  8. check string contain java
  9. check string contains number
  10. check string contain character in javascript
  11. check string contains in jquery
  12. check string contain sql
  13. check string contains special characters java

Below shown is my HTMLcode : <!doctype html> <html lang="en"> <title></title> <head> <script scr ="myprog.js"> </script> </head> <...

Below shown is my HTMLcode : <!doctype html> <html lang="en"> <title></title> <head> <script scr ="myprog.js"> </script> </head> <...