0
如何從PHP發送數組到jQuery?jQuery:發送數組
我有很多<input type = "text" id = "search_term" />
。我如何將這些數據發送給jQuery?
<head>
<script>
$(document).ready(function(){
$('#button1').click(function(){
var search_val=$("#search_term").val();
$.post("ajax.php",
{ search_term : search_val },
function(data) {
$("#search_results").html(data);
}
);
});
});
</script>
</head>
<body>
<input type = "text" id = "search_term" />
<input type = "text" id = "search_term" />
<input type = "text" id = "search_term" />
...
<input type = "button" id = "button1" value = "test" />
</body>