var htmlGeneratedContent = '<td align="right"><input type="button" value="Save Comment" class="button" onClick="' +
'submitToServer(' + key + ',' + userID + ',' + batchID + ')' +
的代碼生成HTML的螢火可見的jQuery - 爲什麼不是我的POST開火?上述
<input type="button" onclick="submitToServer(1111,bmackey,2222);deActivateThat();" class="button" value="Save Comment">
但是當我點擊我的功能不火
function submitToServer(key, userID, batchID) {
$.post("savePage.aspx",//breakpoint never hit
{ key: key, userID: userID, batchID: batchID }
);
}
我試着包裝我生成的字符串產生submitToServer('1111','bmackey','2222')
。代碼
'submitToServer(\"' + key + '\",\"' + userID + '\",\"' + batchID + '\")' +
結束了生成HTML錯誤。
<input type="button");deactivatethat();="" 2222="" ,="" bmackey="" 1111="" onclick="submitToServer(" class="button" value="Save Comment">
'鑰匙'是保留字..AFAIK – diEcho 2011-04-18 17:54:55