AJAX: How to get xml data using XMLHTTP.responseXml where xml data processed in C# code

Hi All,

I am trying t retrieve data from an xml file on server side using Ajax:

How to get xml data using XMLHTTP.responseXml  where xml data processed in C#  as:-

C# part

xmldoc.Load(xmlfile);

this.Response.ContentType= "text/xml";

this.Response.Write(xmldoc);

--- AJAX- Javascript part is ---

if(XMLHTTP)

{

XMLHTTP.onreadystatechange = function()

{

if(XMLHTTP.readystate==4 && XMLHTTP.status == 200){

var xmlDoc = XMLHTTP.responseXml; //********  HERE THIS IS NOT RETRIEVING THE xml data instead this brings  XMLHTTP.responseText data ****

  }

}

 

XMLHTTP.open("GET", requestUrl, true);

 

XMLHTTP.send(null);

}

 

something problem in the C# side ? please anybody can answer this?... Thanks in advance.

prs

0
mpvs
12/4/2007 4:26:28 PM
asp.net.ajax-discussion 13973 articles. 1 followers. Follow

3 Replies
1017 Views

Similar Articles

[PageSpeed] 2

If you aren't doing any processing on the server side, you're probably better off reading and outputting it as a text file.  Your xmldoc is an XmlDocument object, so Response.Write(xmldoc) isn't going to do what you probably want.  If you need to use XmlDocument for more complex processing not shown, try outputting it with Response.Write(xmldoc.InnerText) instead.
 


Encosia - ASP.NET, AJAX, and more.

Latest article: Using complex types to make calling services less… complex
0
gt1329a
12/4/2007 5:17:11 PM

First of all Thanks for your reply. In my case  I want to get data from the server as xml data. I tried with Response.Write(xmldoc.InnerText) . In this case  XMLHTTP.responseXml has no value.  offcourse XMLHTTP.responseText has value. But actually I need XmlData from the server. Is there any method for this? Thanks and Regards.

 

0
mpvs
12/5/2007 6:57:32 AM
I'd suggest just putting a debugger breakpoint on the part of your code that writes out the XML and explore what is actually available in that object.  Knowing what you want, you should recognize it quickly when you see it.  Just a Response.Write(xmldoc) is definitely not going to be what you're after though.

Encosia - ASP.NET, AJAX, and more.

Latest article: Using complex types to make calling services less… complex
0
gt1329a
12/5/2007 7:07:08 AM
Reply:

Similar Artilces:

Using ajax xmlhttp from code behind to pass data as xml
Hi! friends If you now answer to this please do reply me My problem is I want to use Ajax xmlhttp from code behind to pass data as xml The data I want to pass is stored in a dataset After passing the data I want to retrieve the data from client side using xmlhttp.responsexml Please refer to this thread: http://forums.asp.net/t/1192673.aspx  ...

how to display item every 30 second using ajax timer and using linq to xml to query data from xml file
how to display item every 30 second using ajax timer   and using linq to xml to query data from xml file...

Editing the xml data using C# code
Hi thanks a lot...................How to edit the xml data that has already been stored in the xml file using C# codings?????????????Please provide me with an example...............................  Reading and Writing XML Documents Hosam Kamel Remember to click on Mark as answer on the post that helped you...

Data Exchange Process using .NET, XSD, XML,etc.
Hello, Could anyone please throw your suggestions on the following scenario? (It would be really helpful if you could provide a solution using .NET,XSLT,XSD,Web Service other than 'Biztalk Server' Approach.) - Honestly speaking, I am new to this Data Exchanging Process, though I have some knowledge in XML,XSLT,Webservice,C#,ASP.net etc. In my project, there is a need to design an interface to handle data exchange between two applications using XML, XSLT ,XSD,.NET , Web Services,etc . Business rule: -------------- Let us say, The data in a XML file from Application A(...

Reading XML data using C# code and displaying content in user interface
Hi.............Thanks a lot in advance..........Please help me to retrieve the xml data using C# codings(xxx.cs file) and then displaying the same data in the user interface (created with text boxes and labels)using C# code...........................Reply me with an example C# codings that will retrieve the xml data and display them in the text boxes and drop down list................   For ex... if this is xml schema <person details>  <person> <name > Lakshman</name> <age>21</age> </person> <person> <name> Sriniv...

how to retrive the XML data by using LINQ and how to store that data in GridView(by using LINQ) Dynamically
Friend's i have 'n' number of tabels.if i select particular table that table data should bind to GridView using XML and LINQ dynamically with their column names. Friend's what i have i done i will give that code :           XmlDataDocument MyDoc = new XmlDataDocument(Ds);                   MyDoc.Save(Server.MapPath("App_Data\\DsFile.xml"));          XElement MyDoc1 = XElement.Load(Server.MapPath(...

Read XML data from SQL Server XML data type field
Hi,does anyone actually use the XML data type for SQL Server database columns? I can't really find any help for my problems.In my database there is a table with personal data such as name, telephone and so one. One of the columns is of type XML, because I need to store multilingual data in there, something like:<career>     <careertext lang="en">My career</careertext>    <careertext lang="de">Meine Karriere</careertext></career>I'm using a Stored Procedure to retrieve all data from the database and in my data access object th...

Retreive xml data from sql 2005 xml data type column
 hi everyone, I am in a messy situation and dieing to get rescued.I have a database with an untyped  xml datatype column named xmlfile.  The xml inside is invoice of customer & looks like this.<User><INVOICE><BILL Time="May 18 2008 12:47AM">0.1869</BILL><BILL Time="May 18 2008  1:00AM">22.25</BILL><BILL Time="May 18 2008  1:00AM">22.25</BILL></INVOICE></User>I wanted to retrieve the <BILL></BILL> Elements and put it through asp:datagrid or asp:repeater . I w...

How do I retrieve the image out of the xml data I get from the xml file
How do I retrieve the image out of the xml data I get from the xml fileAs shown in the example.<?xml version="1.0" encoding="utf-8" ?> <maps>      <image>!^asfd*#dsafdasfas@$dsfh.......</image></maps> It's likely that the bytes of the image have been Base64 encoded.  In order to take that Base64 string and create an image from it, do the following:   byte[] b = Convert.FromBase64String(yourBase64StringHere);    System.IO.MemoryStream ms = new System.IO.MemoryStream(b);    Syste...

Accessing XML data with AJAX Problems
I have a dynamically created XML file with something like... <seasons>    <season>summer</season>    <season>fall</season>    <season>winter</season>    <season>spring</season> </seasons>  /*****************************/ //now I want to write those seasons into an aspx page using JavaScript, ie.... var myDiv = document.getElementById("someDivOnMyPage"); var seasonItems = req.responseXML.getElementsByTagName("season"); var elemSeason1 = ""; va...

I can show xml data in repeater, but how to save changed data back to xml?
I want to be able to choose which images in a folder should be used for the AdRotator on my web site.So what I've done is created a simple web page where I can view all images in a folder. As each image is displayed using a Repeater, a checkbox is added. The image's filename is checked (using a loop) against the filenames in the AdRotator's xml file. If the image is listed in the xml file then the checkbox is ticked, so the user can see which images are currently selected to be displayed. This all works fine.I can then tick or untick the checkbox for any image depending on whether I want eac...

post or send data through ajax using xmlhttprequest not ajax toolkit
 sorry if i place the post in wrong forum,actually i want to post data to server for save like user information,name,description etc so how to send the data to server sideone method is that to use query string  like url="/foldername/pagename.aspx?name="+ abc.value etc.now if i have in description more than 700 word +other fields data so how i post this data to server for saving.note :i ma not using any tool kits.i use simple http xml request .  this should help you:  http://www.jibbering.com/2002/4/httprequest.html  sorry for disturbance,but the link yo...

Using POST method to post the xml data + other data to the server?
Hello, Can anyone tell me what I did wrong based on the code I have below? I want to send the xml data and other data to the server. The example of request looks something like this: https://www.abc.com/data?username=myID&userpassord=myPassword  and also the data parameter for xml data.  The request should be URL-encoded and the content type of the request set to "application/x-www-form-urlencoded".  So I have the code below but gets an error where it gets the response from the web server "The remote server returned an error: (500) Internal S...

Getting XML into one data table
I am currently trying to get XML like the following <?xml version="1.0" encoding="utf-8"?><Videos FileDesc="Personal Video Collection">  <Video ISBN="0-7888-1623-3">    <Title Screenplay="Marty Kaplan">The Distinguished Gentleman</Title>    <Director>Jonathan Lynn</Director>    <Actors><Actor>Eddie Murphy</Actor><Actor>Lane Smith</Actor><Actor>Sheryl Lee Ralph</Actor><Actor>Joe Don Baker</Actor>    </Actors>    ...

Web resources about - AJAX: How to get xml data using XMLHTTP.responseXml where xml data processed in C# code - asp.net.ajax-discussion

XMLHttpRequest - Wikipedia, the free encyclopedia
Data from the response can be used directly to alter the DOM of the currently active document in the browser window without loading a new web ...

Java FAQs: Ajax
Browse jGuru's expert answers to the most frequently asked Java and Ajax questions.

onreadystatechange Property (IXMLHTTPRequest)
var xmlhttp= null ; function PostOrder(xmldoc){ var xmlhttp = new ActiveXObject( "Msxml2.XMLHTTP.6.0" ); xmlhttp.Open( "POST" , "http://myse ...

Raible Designs - Roller
Upgraded to Roller 1.0 Dave released Roller 1.0 yesterday, so I decided to spend 20 minutes and upgrade today. I have customized a few pieces ...

Ajax and client-server interaction standards
Which interface for a modern application? Comparison of all solutions: Ajax, XAML, JavaFX, and also the new standards of the Web. The evolutions ...

Simple Tutorial to Make a Chrome Extension that uses jQuery UI
Google Chrome has had extensions for a while now, but because the Linux client is a little farther behind I never got farther than the simple ...

AJAX XMLHttpRequest Server Response
Free HTML CSS JavaScript DOM jQuery XML AJAX Angular ASP .NET PHP SQL tutorials, references, web building examples xmlDoc=xmlhttp.responseXML; ...

Twitter和饭否的好友管理工具
微博客做为社会化网络的重要组成部分,具有比传统即时通讯(IM)软件更多的优势,例如可以看到好友的好友,可以关注陌生人的信息,但这也带来另一个问题:信息过载。 如果用户关注(Follow)的用户数非常多,那么将在短时间内接收到大量来自好友的“信息轰炸”,这显然会给降低未必可的可用 ...

Using web workers - MDN
Dedicated Web Workers provide a simple means for web content to run scripts in background threads. Once created, a worker can send messages to ...

public-webapps@w3.org from April to June 2013 by subject
W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2013 public-webapps@w3.org from April to June 2013 by subject 1002 ...

Resources last updated: 12/6/2015 1:21:35 PM