Thursday, 15 May 2014

javascript - Passing Values To JS With HTMLButton Generated With PHP -



javascript - Passing Values To JS With HTMLButton Generated With PHP -

i have forms ajax , jquery load page php script.

but problem arises onclick= event generated php.

the error fires when button clicked.

and i'm sure page's native js fine.

i'm pretty sure there error php generated line.

<button type="button" class="button" value="add" onclick="mail_m_plex(0,"add");" name="action">add</button>

here browser sees after page loads

<button type="button" class="button" value="add" onclick="mail_m_plex(0," add");"="" name="action">add</button>

why ="" added , add changed lower case add?

this erroruncaught syntaxerror: unexpected token } line 2

my question should done phone call mail_m_plex(0,"add"); when button pressed?

here total php print out

$output = '<tr>'. '<td><input name="email" type="email" id = "0email" value="" required placeholder="mark@smith.com" ></td>'. '<td><input name="fname" type="text" id = "0fname" value="" required placeholder="mark"></td>'. '<td><input name="lname" type="text" id = "0lname" value="" required placeholder="smith"></td>'. '<td><button type="button" class="button" value="add" onclick="mail_m_plex(0,"add");" name="action">add</button>'. '</td>'. '<td></td>'. '</tr>'; echo($output);

here html loads into,

<tbody id="partyemails"> </tbody>

use single quotes :

<button type="button" class="button" value="add" onclick="mail_m_plex(0,'add');" name="action">add</button>

javascript php html ajax

No comments:

Post a Comment