Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

ajax response assign to the text fields

Posted on 2008-06-17
3
Medium Priority
?
232 Views
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
Thanks
Sam
0
Comment
Question by:newbie27
  • 2
3 Comments
 
LVL 8

Author Comment

by:newbie27
ID: 21805399

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
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 21811930
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
 
LVL 8

Author Closing Comment

by:newbie27
ID: 31468058
thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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…

569 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