How to display html content in colorbox jquery

I want to display html content in jQuery colobox. here im uses the ajax function to send my data, but the success function returns some html page. now i want to display html content in colorbox. how can i do this .. my code looks something like this:

$('#submitButtonName').click(function(event) {
  event.preventDefault();
  alert("press");
  var send=$("#ajaxadd").serialize();
  alert(send); 
  $.ajax({
    type:"POST",
    url:"/patient_add",
    data:send,
    success: function(msg) {
      $("#gg").html(msg);// here gg is the id which im try to retrieve from my html page. not getting exactly.
      alert(msg);
     //$(".display").colorbox({html:'<p>Hello</p>'});
    }
});
$(".display").colorbox({html:send});

here is my html file. I want my patient name, uhid, to show the age in the colorbox.

<body>
<div id="gg">
<form id="FormName11" action="/display" method="post" name="FormName11">
<table>
<tr><div  align="center"><h2><b><u>Fortis-Medremind Patient Receipt</u></b><h2></div></tr>
</table>
<table>

<b>PatientName</b>: {{patientinfo_all.name}}
<br>
<b>UHid</b>         : {{patientinfo_all.uhid}}
<br>
<b>Age</b>          : {{patientinfo_all.age}}
<br>

</form>
</div>

thanx in advance.

+3
source share
1 answer

One way to wrap it in textarea tags.

eg.

var response = '<textarea style="width:688px; height:458px">' + data + '</textarea>';
$.colorbox({title:'Response',width:'700px',height:'500px',html:response});
+5
source

All Articles