Hi,
I have a page (MainPage.aspx) that contains transformed XML data in different divs. The transformation is done in C# with an XML and an XSL file. The requirement is, based on user input , the xml should be updated which will update the page as well.
I have a javascript which takes the input from a input field from mainpage.aspx and sends to the C# code which updates the XML and reloads the page with the Updated XML data.
But I want to refresh only the div whose data is updated rather than the whole Page.
Can I use XMLHTTP request for reloading a specific div of the mainpage.aspx. If yes, is there any example which I can refer?
Appreciate any help.
7 3261
Welcome to TSDN!
Can I use XMLHTTP request for reloading a specific div of the mainpage.aspx. If yes, is there any example which I can refer?
Yes, of course. See an example. Also check out the Ajax tutorial links in the Off-site Links thread.
the problem I have here is the div contains some xml data and the div needs to be updated when there is an update in xml data. - xmlHttp.open("GET", url,true);
-
var str=xmlHttp.responseText
-
document.getElementById(div).innerHTML = str;
-
In the above code, we are passing the url of the page that contains the div. so str would contain the text that the whole page contains.And when we pass str to the div, it would display the whole page again in the div.
How can i extract the div from a page.so that i can passonly the div content to the div's innerHtml?
How can i extract the div from a page.so that i can passonly the div content to the div's innerHtml?
The best way would be to code your server-side script to only return the div and nothing else.
If, for some reason, that isn't possible or you don't wish to change that code, you will have to parse the response text for the div by using DOM methods, e.g. document.getElementById().
Hi
How can I parse the response text. I dont want to pass the conent of the whole URL, rather I want to pass the contents of a div only.
Is there any example to refer? Thanks
Welcome to TSDN!
Hi
How can I parse the response text. I dont want to pass the conent of the whole URL, rather I want to pass the contents of a div only.
Is there any example to refer? Thanks
Can you give an example of a response from the server and what you want to parse out from it.
I have multiple divs in my page. Among them, the div "DivXMLContainer" populates some data from xml data. Now when I add some data to the xml, I want to refresh the div with the updated data.
When I use the xmlhttp.open(Get, URL), I pass the url of the page . Hence the xmlhttp.responsetext gets the whole page .
Now the following line would display the entire page's content inside the div.
document.getelementbyID.("DivXMLContainer").innerH TML= xmlhttp.responsetext
Is there any way , I can parse the 'DivXMLContainer' from the responsetext or is there any other way around?
Let me know if I need to put the XHTML code here.
Thanks
You could do using responseText.getElementsByTagName("div") and then checking the id.
However, wouldn't it be better to just do this on the server-side instead, i.e. let the server-side code just return the required XML, so there's no need to parse the data.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Mel |
last post by:
i would like to have a link, such that when the user clicks on it, a script
is fired to go to server and check for page updates, if any, it should
request a reload, else stay silend (terminate)
...
|
by: robert.waters |
last post by:
Hello,
I am dynamically editing the contents of a page and using
document.write() to reload the new, edited content. However, on the
new page, any calls to functions located in external .js...
|
by: WAZOO |
last post by:
Sorry if this is obvious to everyone (except me). I've done a Google search
and I'm not seeing anything encouraging that addresses my issue.
My very large multispecialty medical practice needs...
|
by: zorhel |
last post by:
Hi.
My clients will be IE, Mozilla and Opera in
a Windows and *nix OS.
So, my web app need to, from a server, send messages to a specific client
(browser), send messages for all clients,...
|
by: T. Wintershoven |
last post by:
Hi all,
Is there a simple way in php to reload a page coded within an if
statement.(see code below)
It's very important that the session stays intact.
The filename is RCStudent.php
...
|
by: defyinggravity |
last post by:
Hi this is a newbie alert! This may seem really basic to most, but I am a total beginner, so please don't laugh, or gif me false info...lol I will use it.
I have an ajax container loading on my...
|
by: SM |
last post by:
Hello,
Im trying to access elements in my XML file using the JavaScript DOM
but i'm not sure how. I use AJAX to access the XML and then use the
responseXML property to access the XML file data.
I...
|
by: jborg |
last post by:
I have a method to send PHP array values via Ajax to another PHP file that processes my request, however I cannot get it to work here.
I know this is normally a basic and very general error, but...
|
by: thatcollegeguy |
last post by:
Below are my 3php and 2js files.
I create a table using ajax/php and then want to change the values in the tables add(+ number for teamid) id's for each specific td in the table. I don't know...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |