I want to send two values via AJAX.
My jQuery function (working fine with single value on the whole page):
function randomfunction(qq, xxx)
{
jQuery.ajax({
type: "POST",
url: "https://someurl.php",
data: "qq="+qq+"&qqq="+xxx,
cache: false,
success: function(data)
{
jQuery("#stuff"+id).html(data);
}
});
}
My input to trigger it:
echo"<input class='inputbutton' style='width: 122px!important;' type='button' id='button_id' value='Anfordern' onClick='randomfunction($qq, $xxx);'>";
I use this type of setup on my page with single values, which works perfectly.
Now I started using 2 and it always gives me the error Uncaught SyntaxError: missing ) after argument list
I already checked and tried these solutions:
I want to pass two parameters in onclick, one is a function & another is a div id
How to send multiple data fields via Ajax?
data: {qq: qq, xxx: xxx},
SyntaxError: missing ) after argument list
JavaScript: SyntaxError: missing ) after argument list
and tried a debug with JSLint and JSHint. I also checked my PHP backend and it works perfectly if I access it manually with something like https://randomlink.php?qq=stuff&xxx=stuff2
.
I even clear my cache everytime I change something to prevent loading old code. I just don't get what is wrong. Can anyone help me? Am I too blind to see the obvious?