Note that there are some explanatory texts on larger screens.

plurals
  1. POReturn value shows error within success method of .ajax()
    primarykey
    data
    text
    <p>I have a jQuery ajax call in my coldfusion page which is as below:</p> <pre><code>function getData(paramValue) { var URL = "/cfc/**somecfc.cfc**?method=**somemethod**"; $.ajax({ type: "POST", url: URL, data: ({ paramValue: paramValue}), dataType: "text", success: function(data) { alert(data);}, error:function (xhr, ajaxOptions, thrownError){ alert("xhr.status = " + xhr.status); alert("thrownError = " + thrownError); } }); } </code></pre> <p>some method in somecfc returns a text value. When I try to view the data within success, it shows the following error:</p> <p><code>"&lt;wddxPacket version='1.0'&gt;&lt;header/&gt;&lt;data&gt;&lt;string&gt;ERROR: . &amp;lt;br /&amp;gt;Element SETTINGS is undefined in a Java object of type class [Ljava.lang.String;.&lt;/string&gt;&lt;/data&gt;&lt;/wddxPacket&gt;"</code></p> <p>Since it shows the error from within <strong>success</strong>, there seems to be problem with the return data or ?</p> <p>Any help to fix this would be highly appreciated.</p> <p>the code in the cfc method is as follows: </p> <pre><code>&lt;cffunction name="somemethod" access="remote" returntype="any" o&gt; &lt;cfargument name="paramValue" type="string" required="yes" &gt; &lt;cfset var returnValue = "" /&gt; &lt;cfquery name="someQry" datasource="#variables.settings['dsn']#" &gt; SELECT value_name FROM valuesTbl WHERE value_Id = &lt;cfqueryparam value="#arguments.paramValue#" cfsqltype="cf_sql_varchar"&gt; &lt;/cfquery&gt; &lt;cfset returnValue = #someQry.value_name# /&gt; &lt;cfreturn returnValue /&gt; &lt;/cffunction&gt; </code></pre> <p>returnValue variable has only 1 string value. Hope this helps!</p>
    singulars
    1. This table or related slice is empty.
    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.
    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