I am stuck by the simple question, I want to make an ajax call a public web service, but got 'undefined' error
<script type="text/javascript">
$(document).ready(function () {
$('#btn1').click(myFunction);
});
function myFunction() {
var strSearch = $('#txt1').val();
var parameters = "{'passage':'" + strSearch + "'}";
$.ajax({
url: 'http://www.esvapi.org/v2/rest/passageQuery?key=IP&passage=' + strSearch + '&options=include-passage-references=true',
type: 'GET',
data: parameters,
dataType: "json",
success: function(result) {
$('#res1').html(result.data);
},
error: function (xhr) {
alert(xhr.data);
}
});
}
</script>
The public service is at http://www.esvapi.org/api
. I believe that it uses 'GET' method.
Debug snapshot: