jquery - My HTML content do not display when I use Javascript -


when use script getting content specific url using ajax, html content not displayed, i.e table element not displayed: data specif url , showing in alert box, , using document.write write on page data coming url called:

<head>   <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.css" />   <script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>   <script src="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.js"></script>   <script type="text/javascript">   $(document).ready(function() {     $.ajax({       type:"post",       url:"http://your url",       success: onsuccess,       error:onerror     });   });   function onsuccess(data){     var servertext=data;     document.write(servertext);     alert(servertext);   }   function onerror(data){     alert(data+'error');   }   </script> </head> <body>   <p> hello</p>   <table height="150px" weight="150px" border="1px">   <tr>     <td><img src="green.png" height="100px" width="100px" /></td>   </tr> </table> 

enter code here

document.write shouldn't used after page has finished loading. if call it, implicitly call document.open, blanks page , creates new document.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -