i have this situation:
<a href="#" onClick="submitNotification(1);">click1</a>
<a href="#" onClick="submitNotification(2);">click2</a>
<a href="#" onClick="submitNotification(3);">click3</a>
function submitNotification(cdata){
navigator.notification.confirm(
'do you like '+cdata+' option ',
submit,
'notice',
'Yes,No'
);
function submit(button){
if (button == 1){
alert(id); //or alert(cdata);
} else if (button == 2){
...
}
}
so, i click on a link, 1 or 2 … gets send to submitNotification where i get a message: do you like 1 option or do you like 2 option or … depending on what link i click.
this function calls submitVote and sends button var to it somehow. yes means 1 and no means 2.
the problem is that i cant get id or cdata from the original link. actually they came as value 3 (the last link).
i use to do:
function submitNotification(cdata){
navigator.notification.confirm(
'do you like '+cdata+' option ',
submit(cdata),
'notice',
'Yes,No'
);
function submit(id){
if (button == 1){
alert(id);
} else if (button == 2){
...
}
}
in this case i get the id alert but the button values are not available.
Any ideas how to get access to that id or cdata, whatever var is available? Is there a way to send both button and cdata vars to the submit function
note: the links get created in a $.each loop.
thanks
Hope this helps (after all the code rewriting :)).
Notice that both
submitNotificationandsubmitare separate functions (not nested in) and varbuttonClickedis defined in global scope.