i'm trying to call an ajax call from a list of elements in php. Well, this is a php code: http://pastebin.com/apf6gtq6
When i generate this list, i want click on the links and send the link to ajax call to perform the request. This is ajax call: http://pastebin.com/mr8NmAy2
But When i click on a link i have got an error of this type:
SyntaxError: Unexpected token ':'. Expected ')' to end a argument list.
I have searched the error but i can't find it. Can you help me? Thank you
答案 0 :(得分:0)
Replace the line with this:
<a onclick=\"theCall(".$flight[$i].")\">".$i."</a>
答案 1 :(得分:0)
Replace your onclick for the else part with this :-
<a onclick='javascript: theCall(" . $flight[$i] . ");'>$i</a>