lundi 28 décembre 2020

ONclick button, two expressions to AJAX, getting errors in ELSE statement but works in if statement

In an onclick button I am passing two expressions separated by a comma. The buttons are part of a PHP IF ELSE statement. There is one button that appears in the IF part of the statement. It also passes two expressions. This button works well. Here is the HTML code for the first button:

<button id='Search' class='button btn' onclick='Search($tbl_id, $cid)'><i class='icon fas fa-globe'></i></button>" 

In the ELSE part of the statement I have another button that needs to also pass two expressions. However with this button I am getting a console error of "expected expression, got ','". This confuses me since the exact same HTML with two expressions works just fine in the IF part of the statement. I have narrowed down the error to being in the HTML by removing the AJAX and still getting the error here. Here is the HTML for the button in the ELSE portion of the statement.

<button id='largerSearch' class='button btn' onclick='largerSearch($tbl_id, $cid)'>Search for alternative <i class='seated-icon fas fa-globe'></i></button>" 

If I remove the comma and remove on expression, then it works fine.

Why does the exact same HTML work and successfully pass two expressions in the IF portion of the statement and fail in the ELSE portion of the statement?

Aucun commentaire:

Enregistrer un commentaire