ajax response assign to the text fields

Posted on 2008-06-17
Last Modified: 2010-04-21
Hello Experts,
I am using these function to do ajax request to the builder.asp which originally has returned comma separated list ids,
I now want to return 2 more information ie: name and notes from the showListRefs function and assign it to the corresponding text fields.
Please can you help
Question by:newbie27
  • 2

Author Comment

ID: 21805399

javascript function


function getListRefs(sListname)



	  type: "POST",

	  url: "list_builder.asp",

	  data: "action=results&listname="+sListname,

	  success: function(msg)


				$("#listRefnos").val( msg );		


				var sRefNumbers = $("#listRefnos").val();

				var sViewQuery = "SF1=keyword&ST1="+sRefNumbers;     

				//alert("sViewQuery: "+sViewQuery);




                                $("#txtListName").val('test6');     //  I want to assign the name here

				$("#txtNotes").val('test notes');   //  and notes here





ASP function


PRIVATE FUNCTION showListRefs(sListName)

    sFilename = ""      	

    sXMLFile = ADMIN_WWW_FOLDER & "\lists\data\" & sFilename            

    Set objXML = Server.CreateObject("Microsoft.XMLDOM")


	If objXML.load(sXMLFile) Then

		Set objRoot = objXML.documentElement

    End if


    Set oNodes = objXML.selectNodes("//lists/*")


	count = 1

	For Each oChild In oNodes


		if oChild.childNodes(0).text = sListName Then

		   	showListRefs = oChild.childNodes(2).text    '   this will give us comma separeted IDs


                        'showListRefs =   oChild.childNodes(1).text   ' this will give the list name	 

                        'showListRefs =   oChild.childNodes(0).text   ' this will give the list notes


		End if


	showListRefs = showListRefs 


END Function

Open in new window

LVL 82

Accepted Solution

hielo earned 500 total points
ID: 21811930
You could pipe separate the data for each record. Intead of just:
showListRefs = oChild.childNodes(2).text    

showListRefs = oChild.childNodes(2).text & "|" & oChild.childNodes(1).text   & "|" & oChild.childNodes(0).text  

Author Closing Comment

ID: 31468058

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (, typical array handling might look like this: (CODE) B…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now