user2715615
user2715615

Reputation: 101

Getting error Uncaught SyntaxError: Unexpected token ILLEGAL while clicking on Onclick

Below is the html code which i am using

<a onclick="submit_details('143','v
VASANT','PATIL','8275053468','425201');" href="javascript:;">2</a>

Below is the function call its going

function submit_details(pid,fname,lname,phone,zip){
    $("#sp_value").val(pid);
    $("#sf_value").val(fname);
    $("#sl_value").val(lname);
    $("#sph_value").val(phone);
    $("#sz_value").val(zip);
    $("#detail_form").submit();
}

whicle clicking i am getting error Uncaught SyntaxError: Unexpected token ILLEGAL in the error console

Upvotes: 0

Views: 2487

Answers (2)

gaurav5430
gaurav5430

Reputation: 13917

You probably have embedded illegal characters in your code.

see :

Uncaught SyntaxError: Unexpected token ILLEGAL

(i am assuming you formatted your function text to fit well on two lines for the sake of posting, but still...) also, while calling the function, there should not be a newline.It should be

<a onclick="submit_details('143','v VASANT','PATIL','8275053468','425201');" href="javascript:;">2</a>

otherwise it might give different errors (based on where you have entered the newline, like interminated string constant error, in your syntax)

Upvotes: 0

rajesh kakawat
rajesh kakawat

Reputation: 10906

make it in single line

 <a onclick="submit_details('143','v VASANT','PATIL','8275053468','425201');" href="javascript:;">2</a>

Upvotes: 2

Related Questions