O尝试了以下代码,我在alert
中得到了值,但我没有得到控制器中的值。我的代码是这样的:
<div class="form-group" id="getarea">
<label>Location </label>
<span id="latitude" class="label label-default"></span>
<span id="longitude" class="label label-default"></span>
<div>
<select name="area" id="address" style="width:226px;height:40px;">
<option value="select_location">Select Location</option>
</select>
</div>
</div>
function findLocation() {
var latitude = $('#latitude').text();
var longitude = $('#longitude').text();
$.ajax({
type: "POST",
url: "{{URL::to('list-property')}}",
data: {
latitude: latitude
},
success: function (data) {
alert(data);
}
});
}
public function addProperty() {
$locationLatitude = Input::get('latitude');
}