I have the following code for a jquery message box. If I click on the following link a message box appears.
<p><a id="msgup" class="">Demo Top</a></p>
<script>
$("#msgup").bar({
color : '#1E90FF',
background_color : '#FFFFFF',
removebutton : false,
message : 'Your profile customization has been saved!',
time : 2000
});
</script>
Now what I am trying to achieve is show the message box when I get "cold" as value in my ajax server response. To achieve this I have tried the following code. but its not working. May be because it is failing to call the jquery function. Could you please how to make it work?
$.ajax({
type: "POST",
url: "<?php echo base_url(); ?>contents/hello",
data: "id="+a_href,
success: function(server_response) {
if (server_response == 'cold') {
//Beginning of the code for message box
$("#msgup").bar({
color : '#1E90FF',
background_color : '#FFFFFF',
removebutton : false,
message : 'Your profile customization has been saved!',
time : 2000
});
//End of the code for message box
// Instead of the message box code I have tried
// alert('Message'); and it worked
}
else {
$("#result").html(server_response);
}
}
}); //$.ajax ends
Thanks in advance :)
NULLand empty''string is different, what isserver_responsethat you get actually?jquery.barfrom?<script src="mysource"></script>) To see the demo of the message box please check this link tympanus.net/Development/jbar I have downloaded the plugin from there. Thanks :)