<script type="text/javascript">
$(document).ready(function(){
$("#btn").click(function(){
var from=$('input#searchfrom').val();
var to=$('input#searchto').val();
datastring="from="+from+"&to="+to;
$.ajax({
type: "POST",
url: "measure.php",
data: dataString,
cache: false,
beforeSend: function(){ $("#btn").val('Connecting...').delay(6000);},
success:function(response){
$('#result').html(response);}
});
});
});
</script>
Follow是保存值的元素
From-<input id="searchfrom" type="text" size="50" placeholder="Enter a location" autocomplete="on">
To-<input id="searchto" onblur="" type="text" size="50" placeholder="Enter a location" autocompete="on" >
<div id="result"></div>
<button type="button" id="btn" >Click</button>
Ajax函数无法传递mesaure页面中的数据但是当一个参数传递时它正常工作请帮我解决这个问题谢谢。