Error in javascript Uncaught Syntaxerror: Missing ) after argument list

Asked

Viewed 137 times

0

inserir a descrição da imagem aquiinserir a descrição da imagem aquiI have a code that changes the value in the bank from 0 to 1 or vice versa, in 80% of cases it manages to make the change but sometimes gives this error Uncaught SyntaxError: missing ) after argument list and I’ve tried to see the bank part and found nothing wrong

JS

function enviaAssociado(CTITULAR) {
if(CTITULAR){
    $("#CTITULAR").remove();
    $.ajax({
        url: 'php_action/enviaAssociado.php',
        type: 'post',
        data: {CTITULAR : CTITULAR},
        dataType: 'json',
        success:function(response) {
            manageTable.ajax.reload();
            //$("#CTITULAR").val(response.CTITULAR);
        }
           });
    }
    manageTable.ajax.reload();
}

PHP

<?php 
require_once 'db_connect.php';
if($_POST) {

    $CTITULAR = $_POST['CTITULAR'];


    $sql = "    UPDATE importsmiles4e.tb_conv
    SET    STAT = CASE
         WHEN  STAT = 1 THEN 0
         WHEN  STAT = 0 THEN 1
         ELSE STAT
       END
    WHERE  substring(CTITULAR,2,6) = '$CTITULAR'";
    $query = $connect->query($sql);

    $CTITULAR = $_POST['CTITULAR'];


    $sql = "    UPDATE importsmiles4e.tb_conv3
    SET    STAT = CASE
         WHEN  STAT = 1 THEN 0
         WHEN  STAT = 0 THEN 1
         ELSE STAT
       END
    WHERE  substring(CTITULAR,2,6) = '$CTITULAR'";
    $query = $connect->query($sql);



    $connect->close();


}
?>
  • Would you kindly pass all the error that is generated in the IDE’s Tracktrace?

  • In the IDE everything is normal, so much so that in most cases it works. I only have what the Chrome console accuses when it error.

  • @Marcospalcao this seeing of the written right side index.php:1, click there and you will be taken straight to the code and the line of error, and inform me.

  • Where are you returning JSON in PHP? Your PHP code shows nothing.

  • Did you check the value of CTITULAR when the error occurs? There will be some parser problem?

  • The value returned when the error is the same as when it does not, the format in the case.

  • @Sam Sorry I didn’t inform you.

  • You’re confused about this. What does index.php have to do with the problem? In your Ajax you’re calling the enviaAssociado.php and is expecting a JSON with dataType: 'json',, that is, the file enviaAssociado.php is thank you to return a JSON, otherwise it will not even enter the success. Only in the PHP code you put in the question (I imagine that is the enviaAssociado.php) is not returning anything, just doing operations in the database. But what is unclear is where the index.php goes into this to error it..

  • i posted what Send returns but got bugged, and only left the index print, https://i.stack.Imgur.com/Mhsdh.png and when it works it always returns something in the same format.

  • Show the code referring to the image, as you are calling the function.

  • @Sam https://i.stack.Imgur.com/LMXP0.png

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.