ajax problem

Home Forums Quform WordPress ajax problem

This topic is: resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34913
    oivanr
    Participant

    Hi,
    I have developed a wordpress site in my localhost, there everything works fine. Now I take it to my production site tnere I have this message: POST https://xxxxx.com/wp-admin/admin-ajax.php 400.
    Also give me this error: /wp-admin/admin-ajax.php:1 Failed to load resource: the server responded with a status of 400 ()
    The ajax-var is: {url: ‘https://xxxxxx.com/wp-admin/admin-ajax.php’}

    I disabled all the plugins except my plugin and quforms and has no effect.
    I written to my host provider and the say everything is fine. I even change my PHP version and nothing differente happen.
    I am including a print screen of the error in console.
    No error in php error log neither wp_debug.
    At console I print the error when execute the ajax:
    1 abort:ƒ(e)
    2 always:ƒ()
    3 catch:ƒ (e)
    4 complete:ƒ()
    5 done: ƒ ()
    6 error:ƒ ()
    7 fail: ƒ ()
    8 getAllResponseHeaders: ƒ ()
    9 getResponseHeader:ƒ (e)
    10 overrideMimeType: ƒ (e)
    11 pipe: ƒ ()
    12 progress:ƒ ()
    13 promise: ƒ (e)
    14 readyState: 4
    15 responseText: “0”
    16 setRequestHeader: ƒ (e,t)
    17 state: ƒ ()
    18 status:400
    19 statusCode:ƒ (e)
    20 statusText:”error”
    21 success: ƒ ()
    22 then:ƒ (t,n,r)
    23 [[Prototype]]: Object

    What I am doing is: when the field (1 – see the attach file) change value (is a dropdown), I invoke a function (line 30)
    24 jQuery(function ($) {
    25     // cambios en los campos dropdown de los formularios
    26     $(‘.quform-field-1_10’).change(function () {
    27         codCuenta = $(‘.quform-field-1_10’).val();
    28         $(‘.quform-field-1_3’).val(codCuenta);
    29         $(‘.quform-field-1_4’).val($(‘.quform-field-1_10 option:selected’).text());
    30         consultaFlds(‘wp_vw_001_002′,codCuenta,’cb_001_codCuenta’,”,”);
    31     })

    The function make an ajax call (line 243 this is line of the php program, the others are just reference numbers):

    238 function consultaFlds(tabla,queBuscar,dondeBuscar,queBuscar2, dondeBuscar2){
    239 var accion = ‘busquedaFlds_Ajax’;
    240 console.log(tabla);
    241 console.log(queBuscar);
    242 console.log(dondeBuscar);
    243 jQuery.ajax({
    244 type : ‘POST’,
    245 url : ajax_var.url,
    246 datatype : ‘json’,
    247 data: {
    248 action : accion,
    249 tabla : tabla,
    250 dondeBuscar : dondeBuscar,
    251 queBuscar : queBuscar,
    252 dondeBuscar2 : dondeBuscar2,
    253 queBuscar2 : queBuscar2
    254 },

    The console log, as you can see send the call to ajax (line 35 – line 243 php code line).
    Then go to ajax and execute the line 2 of php-ajax-admin (line 32)
    32 send @ jquery.min.js?ver=3.6.1:2
    33 ajax @ jquery.min.js?ver=3.6.1:2
    34 s.ajax.s.ajax @ jquery-migrate.min.js?ver=3.3.2:2
    35 consultaFlds @ chatBotLib.js?ver=6.1:243
    36 (anónimo) @ chatBotLib.js?ver=6.1:7
    37 dispatch @ jquery.min.js?ver=3.6.1:2
    38 y.handle @ jquery.min.js?ver=3.6.1:2
    39 handleMouseUp_ @ desconocida

    And send me this error (what I included earlier):
    <b>POST https://xxxx..com/wp-admin/admin-ajax.php 400.</b>

    Thanks in advance for your help.

    • This topic was modified 2 weeks, 5 days ago by oivanr. Reason: include host address
    • This topic was modified 2 weeks, 5 days ago by oivanr. Reason: More information
    Attachments:
    You must be logged in to view attached files.
    #34922
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #34937
    oivanr
    Participant

    Thanks.
    It works fine. The issue was the name of my ajax handler.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2022 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy