• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

ajax response assign to the text fields

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
Thanks
Sam
0
newbie27
Asked:
newbie27
  • 2
1 Solution
 
newbie27Author Commented:

javascript function
----------------------
function getListRefs(sListname)
{
	$.ajax({
	  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);
				
				listViewer("#listDisplay1",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 = "test@test.com.xml"      	
    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
	Next 
	showListRefs = showListRefs 
 
END Function

Open in new window

0
 
hieloCommented:
You could pipe separate the data for each record. Intead of just:
showListRefs = oChild.childNodes(2).text    

try:
showListRefs = oChild.childNodes(2).text & "|" & oChild.childNodes(1).text   & "|" & oChild.childNodes(0).text  
0
 
newbie27Author Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now