below code snippet. have used fetch attributes html , passing sever using ajax. on sucess of ajax need return content on html page.
var hotel=$( "#listhotel option:selected" ).val(); $.ajax({ url: "/gethotels", contenttype: "application/xml; charset=utf-8", data: {'hotel':hotel}, type: "get", success: function(response){ var r= json.parse(response); var rating =r.message alert(rating); $("#rate").html("ratings : "+rating); $("#rate").show('slow'); console.log(rating); }, error: function(error){ alert(response); console.log(error); } }); is possible dynamically change html using jquery get method. because below scripts not working
$("#rate").html("ratings : "+rating); $("#rate").show('slow');
try defining datatype of ajax call json:
var hotel=$( "#listhotel option:selected" ).val(); $.ajax({ url: "/gethotels", contenttype: "application/xml; charset=utf-8", data: {'hotel':hotel}, type: "get", datatype: "json", success: function(response){ var r= response; var rating =r.message alert(rating); $("#rate").html("ratings : "+rating); $("#rate").show('slow'); console.log(rating); }, error: function(error){ alert(response); console.log(error); } });
Comments
Post a Comment