How to transfer a string from cgi at server side to a javascript function at client side as an argument?

zxo102 zxo102 at gmail.com
Mon Oct 12 05:07:26 EDT 2009


Hi everyone,
    How can I transfer a string from a cgi at server side to a
javascript function at client side as an argument? Here is my case:

1. client side: javascript in html page:
...
mygrid = new dhtmlXGridObject('gridbox');
.......
var cgi3 = "/bop-cgi/xbop";
cgi3 += "?requestIds=[wisco.mProducts.dboProducts.mySearch]";
cgi3 += "&wisco.mProducts.dboProducts.searchString=1=1";

mygrid.loadXML(cgi3);

........

2. server side cgi: wisco.mProducts.dboProducts.mySearch
...
def mySearch(self):
             self.search()
             row_count = self.response['rowCount']
             myStr = """<rows total_count="%s" pos="%s">"""%
(row_count, 1)
	for i in range(len(self.response['dbcCode'])):
                    a = self.response['dbcCode'][i]
 	       c = self.response['dbcId'][i]
		    myStr = myStr + "<row id = '%s"%c + "'>"
		    myStr = myStr + "<cell>" + a + "</cell>"
		    myStr = myStr + "<cell>%s"%c + "</cell>"
		    myStr = myStr + "</row>"
            myStr = myStr + "</rows>"
...
I want the myStr to be transferred to mygrid.loadXML like:

mygrid.loadXML('<rows total_count="100" pos="1"><row
id="2"><cell>xxxxx</cell></row></rows>')

Any ideas?

Thanks in advance for your help.

ouyang



More information about the Python-list mailing list