Maybe not the best solution, but here's something that work: var new_element = xmlData.get(0).createElement('new_element_name'); xmlData.find('your_query').append(new_element);
On Wed, Aug 26, 2009 at 1:49 PM, g...@iec<abhi.pur...@gmail.com> wrote: > > In ajax call, i set dataType as 'xml' and on success, i call a > function in which i am passing xml which i got as response. > And in the function i a assigning that data to a global variable so > that i can access it from any function. > I am assigning it to a global variable as shown below : > xyz : function(data){ > xmlData = $(data); > ......... > ........ > } > like this and then i need to modify xmldata if there is any change in > form and on submit of form, i am sending xmlData back to server using > ajax call. > > So please guide me accordingly to modify xml in global variable on > change in form data from any other function. > > On Aug 26, 3:47 pm, Paolo Chiodi <chiod...@gmail.com> wrote: >> You don't have to use xmlData, which is the jquery object, but data >> which is the xml dom (if you set xml as type of the request) >> >> Paolo >> >> On Wed, Aug 26, 2009 at 12:35 PM, g...@iec<abhi.pur...@gmail.com> wrote: >> >> > Thanks for your reply. >> > But this is not working.The data which i got as a result from ajax >> > call on success, i stored it in a global variable. >> > Like this >> > var xmlData = $(data); >> > But when i was executing like you told, it is not creating an >> > element. >> >> > On Aug 26, 1:49 pm, Paolo Chiodi <chiod...@gmail.com> wrote: >> >> when you do document.createElement you create an element that is child >> >> of "document" document. >> >> Try to create the element with data.createElement. >> >> >> Paolo >> >> >> On Wed, Aug 26, 2009 at 10:14 AM, g...@iec<abhi.pur...@gmail.com> wrote: >> >> >> > I am making an ajax call and in response, i am getting an XML. >> >> > And then using data from XML, i am creating a form. >> >> > I stored response XMl in a variable like this >> >> > var xmlData = $(data); >> >> > If there is any change in any field of form then i am changing >> >> > corresponding node value in xmlData >> >> > by appending new node in related node like this : >> >> > var val = document.createElement('{nodename}'); >> >> > $(val).text({changed value}); >> >> > $({corresponding node}).append($(val)); >> >> >> > This is working fine in FF but not working in IE. >> >> >> > Kindly guide me how can i solve this problem. >> >> >> > Thanks in advance to all for providing guidance.