Note that there are some explanatory texts on larger screens.

plurals
  1. POInvalid JSON errors from JQuery with ColdFusion CFC, even with seemingly correct JSON returned
    primarykey
    data
    text
    <p>I was looking at Ben's example @ <a href="http://www.bennadel.com/blog/1515-Ask-Ben-Building-An-AJAX-jQuery-And-ColdFusion-Powered-Application.htm" rel="nofollow">http://www.bennadel.com/blog/1515-Ask-Ben-Building-An-AJAX-jQuery-And-ColdFusion-Powered-Application.htm</a> and wokring on an ultra simplistic example of my own. but it seems like even though the CFC returns properly formatted JSON, it always ends up in my error handler with the error : </p> <pre> Invalid JSON: {"ERRORS":"","SUCCESS":true,"DATA":"id DEX015-002-00, whs W1, qty 9"} </pre> <p>Here's the ajax call </p> <pre><code>$.ajax({ type: 'GET', url: 'bridge.cfc', data: { method: 'UpdateQty', id: 'DEX015-002-00', whs: 'W1', qty: '9' }, dataType:'json', success: function(res, status, req){ alert("Message from server:\n" + "res: " + res); }, error: function(req, status, err){ "Error from server:\n" + "err: " + err); } }); </code></pre> <p>And heres the CFC "bridge.cfc" </p> <pre><code>&lt;cfcomponent&gt; &lt;cffunction name="UpdateQty" access="remote" returntype="struct" returnformat="json" output="false"&gt; &lt;cfargument name="id" required="yes" type="string"&gt; &lt;cfargument name="whs" required="yes" type="string"&gt; &lt;cfargument name="qty" required="yes" type="string"&gt; &lt;cfset res = structNew()&gt; &lt;cfset res.success = true&gt; &lt;cfset res.data = "id " &amp; arguments.id &amp; ", whs " &amp; arguments.whs &amp; ", qty " &amp; arguments.qty &gt; &lt;cfset res.errors = ""&gt; &lt;cfreturn res &gt; &lt;/cffunction&gt; &lt;/cfcomponent&gt; </code></pre> <p>What am I missing ? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload