I have the following script, which returns me the following error in my console:
Uncaught SyntaxError: Unexpected token }..
The } in between ** is the one causing the problem according to my console. But that’s the bracket which closes the ‘success’ of the AJAX request.. And also if i remove the statement pointed out with the -> the error seems to disappear. Does someone see what is wrong about this?
Note: I don’t have those ** in my code, that’s just for pointing out the error.
$(document).ready(function() {
$('#edit_patient_info').click(function () {
//Get the data from all the fields
$.ajax({
url: "patient_info_controller.php",
type: "POST",
data: data,
success: function (msg) {
if (msg==1) {
getPersoonlijkGegevens(user_id);
unLockFirstPage();
alert("Gegevens zijn gewijzigd!");
$("#searchbox").val(voornaam.val());
searchPatient();
-> $('#selectable li:first').addClass('ui-selected');
}
**}**
});
});
});
You had a hidden character after
$('#selectable li:first').addClass('ui-selected');That invalidated your code. Usually, these can be seen when you copy your code to notepad (Or notepad++).
In notepad++, it displayed
.addClass('ui-selected');?Also, you had a extra
}.Try this: