Total members 11889 |It is currently Thu Mar 28, 2024 2:53 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Code:

<html>
<
head>
<
title>Get File using AJAX under JQuery</title>
<!--
 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
 Note you can download the JQuery package instead of using Google version. --> 
<script src="jquery-1.8.3.js"></script>
<script>
 $(document).ready(function(){
   $("button#b1").click(function(){
  $("div#d1").load("smallTable.html",function(responseTxt,statusTxt,xhr){
    if(statusTxt=="success")
      alert("New content loaded successfully!");
    if(statusTxt=="error")
      alert("Error: "+xhr.status+": status:"+xhr.statusText);
  });
 });
  
});
</script>
 </head>
<body>
<div id="d1"  >This Text is inside the Div</div>
 <br>
<button  id="b1">Load HTML File</button>
  </body>
</html>


smallTable.html:
Code:
<table>
<
tr>
<
td>
Account 1
</td>
<
td>
Account 2
</td>
</
tr>
<
tr>
<
td>
543USD
</td>
<
td>
433USD
</td>
</
tr>
</
table>
 


Related Error you may face :
scripting-language/solution-to-error-status-zero-when-using-ajax-with-jquery-t10684.html



_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Load file and update content using AJAX and JQuery
 Load Content to Tabs using AJAX and JQuery     -  
 Update table with search box using ajax     -  
 Load tweets using JQuery     -  
 Load RSS feeds and parse it with JQuery     -  
 Change the content of select tag using JQuery     -  
 update an xml file with jaxb     -  
 update an xml file with jaxb and accessing to its elements     -  
 Solution to Error status zero when using Ajax with JQuery     -  
 display the content of text file     -  
 Read XML file content using SAX and writing its as SQL     -  



Topic Tags

JQuery Content
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com