如何更改下面的代碼,而不是使用提交按鈕的文本輸入類型我想要多個提交按鈕,每個提交按鈕都有自己的唯一值?我嘗試的所有事情都是以未定義的提交值爲結束。任何幫助將是偉大的!帶多個提交按鈕的Ajax
代碼源:Submit Search query & get Search result without refresh
<script type="text/javascript">
$(function() {
$("#lets_search").bind('submit',function() {
var value = $('#str').val();
$.post('db_query.php',{value:value}, function(data){
$("#search_results").html(data);
});
return false;
});
});
</script>
<form id="lets_search" action="" >
Search:<input type="text" name="str" id="str">
<input type="submit" value="send" name="send" id="send">
</form>
試$( '#發送')。點擊(function(){// code here});和類型=「提交」insted把它作爲類型=「按鈕」 – Vamsi 2012-07-28 07:37:46