<script language="javascript" type="text/javascript">
$(function () {
/* HTML Menu Example Code */
$('#GlobalNav')
.load('http://navservice.intranet.hpr/api/gethtml', function(){
initmenu();
});
});
</script>
How do I convert this to sth like this? except the data type is plain html coming from the webservice?
$.ajax({
url: "Common.asmx/InsertClient",
type: "POST",
dataType: "json",
data: "{BizName:'" + BizName + "'}",
contentType: "application/json; charset=utf-8",
success: function(msg) {
$('#status').html('Id: '+msg['d']['Id']);
}
});
$.ajax
:
$.ajax({
url: 'http://navservice.intranet.hpr/api/gethtml',
type: 'GET',
success: function (html) {
$("#GlobalNav").html(html);
}
});
... Or $.get
:
$.get('http://navservice.intranet.hpr/api/gethtml', function (html) {
$("#GlobalNav").html(html);
});
Keep in mind that .load
callback function accepts the HTML retrieved from the server, so you may be able to keep using that depending on what you're trying to accomplish.