String:
$ ('# contact-bottom'). css ('background': '# 3F51B5 url (' + ' img / check.png '+') no-repeat 50% 50% ');
Error:
Uncaught SyntaxError: missing) after argument list
The entire piece of code in ajax:
$. ajax ({
type: "POST", // Submission method
url: "mail.php", // path to the sender's php file
data: form_data,
success: function () {
console.log ("Message successfuly send");
$ ("# mail-button"). detach ();
$ ('# contact-bottom'). css ('background': '# 3F51B5 url (' + 'img / check.png' + ') no-repeat 50% 50%');
}
});
Answer 1, authority 100%
Missing brackets {} required to create an object – argument to the function $ (). css :
$ ('# contact-bottom'). css (
{'background': '# 3F51B5 url (' + 'img / check.png' + ') no-repeat 50% 50%'}
);
or replace : with , :
$ ('# contact-bottom'). css (
'background', '# 3F51B5 url (' + 'img / check.png' + ') no-repeat 50% 50%'
);
Answer 2
The ('string': 'string') constructs in JS raise questions – why a colon?
Out 2:
-
Turn this into an object where
:is legal:
({'background': '# 3F51B5 url (' + 'img / check.png' + ') no-repeat 50% 50%'});. -
Either abandon this construction (in
jQuery, you can set one rule
like this:('background', '# 3F51B5 url (' + 'img / check.png' + ') no-repeat 50% 50%');).