Error in response in jquery ajax request

I have a script that sends some form data to Quickbase, and I get what the browser interprets as a JavaScript error in the Quickbase XML response. Right now, the data is being correctly written to Quickbase, but I cannot suppress the parsing error. In addition, I do not have access to server languages ​​- only client-side JavaScript.

Here is the Ajax code:

myObject.prototype.get = function (url, formdata, context, callback) {
    var options = {
        "url": url,
        "type": "GET",
        "data": formdata,
        "context": context,
        "complete": callback,
        "dataType" : "jsonp",
        "dataFilter" : function (data,type) { 
            alert(data);
        }
    };
    jQuery.ajax(options);
};

URL-, , : https://www.quickbase.com/db/xxxxxx?act=API_AddRecord&apptoken=xxxxxxxx&callback=jsonp1284044371978&_fid_11=www.domain.com&_fid_12=xxxxx&_fid_17=xxxxxx&_fid_6=xxxxx&_fid_10=xxxxxxxx&=No+Thanks

, JSONP , , , XML:

<?xml version="1.0" ?>
<qdbapi>
    <action>API_AddRecord</action>
    <errcode>0</errcode>
    <errtext>No error</errtext>
    <rid>740</rid>
    <update_id>1284045768176</update_id>
</qdbapi>

Firebug :

"

<errcode>0</errcode>\n

, dataFilter, . script , .

, , Quickbase; , , .

Edit , , , , JavaScript, QuickBase , XML, * End Edit *

- :

  • dataFilter ?
  • ?

----------

: Vivin Paliath , : , - . . , .

  • iframe

    <iframe id="myHiddenIframe" name"myHiddenIframe" src="#" height="1" width="1" style="display:hidden"></iframe>

  • <form id="myForm"> :

    var myAnswers = $('#myForm').serialize();

  • URL-, :

    var myUrl = 'https://www.quickbase.com/db/xxxxxxx?act=API_AddRecord&apptoken=xxxxxxxx&'+myAnswers;

  • iframe URL-, $('#myHiddenIframe').attr('src', myUrl);

----------

+3
2

JSONP, - Javascript. , , eval XML, Javascript ( , , ). . , QuickBase Javascript.

- , -, QuickBase, XML AJAX. , ( QuickBase JSONP).

JSONP , SCRIPT. SCRIPT , Javascript, . JSONP JSONP. , , Javascript, , . , QuickBase JSONP, - :

jsonp1284044371978({
   qdbapi: {
      action: "API AddRecord",
      errcode: 32,
      errtext: "No such database",
      errdetail: "The application does not exist or was deleted. If you followed a link to get here, you may want to inform the author of that link that the application no longer exists.",
      dbid: "xxxxxx"
   }
});

SCRIPT, . , , QuickBase.

, , , , QuickBook, XML, Javascript. , SCRIPT :

<script type="text/javascript" src="https://www.quickbase.com/db/xxxxxx?act=API_AddRecord&apptoken=xxxxxxxx&callback=jsonp1284044371978&_fid_11=www.domain.com&_fid_12=xxxxx&_fid_17=xxxxxx&_fid_6=xxxxx&_fid_10=xxxxxxxx&=No+Thanks">
</script>

:

<script type="text/javascript">
<qdbapi>
   <action>API_AddRecord</action>
   <errcode>32</errcode>
   <errtext>No such database</errtext>
   <errdetail>
      The application does not exist or was deleted. If you followed a link to get here, you may want to inform the author of that link that the application no longer exists. 
   </errdetail>
   <dbid>xxxxxx</dbid>
</qdbapi>
</script>

, , Javascript. , ( , "" , SCRIPT). , , - XML ( jQuery). , QuickBase -, , , QuickBase. XML AJAX. , , dataType jQuery AJAX xml jsonp.

Jon IFRAME.

+1

Source: https://habr.com/ru/post/1764015/


All Articles