meirulexite
asked on
xmlhttprequest action
Hello,
I have a page full with checkboxes, each with a diffrent value and name,
I want to have a xmlhttprequest action, when a user clicks on the check box, an action will be made (query on a db)
then the checkbox will change to a select field with a similar name.
WITHOUT having to refresh the page..
Curently I have them side by side:
<input type="checkbox" title="CName1"><Select name="SName1"><option..... ></select>
<input type="checkbox" title="CName2"><Select name="SName2"><option..... ></select>
<input type="checkbox" title="CName3"><Select name="SName3"><option..... ></select>
I have a page full with checkboxes, each with a diffrent value and name,
I want to have a xmlhttprequest action, when a user clicks on the check box, an action will be made (query on a db)
then the checkbox will change to a select field with a similar name.
WITHOUT having to refresh the page..
Curently I have them side by side:
<input type="checkbox" title="CName1"><Select name="SName1"><option.....
<input type="checkbox" title="CName2"><Select name="SName2"><option.....
<input type="checkbox" title="CName3"><Select name="SName3"><option.....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm new to xml requests... what is the csv file?
ASKER
where do I put the db query?
is it on a diffrent file?
can I put it on the same file? I have some data that is for each opened page....
is it on a diffrent file?
can I put it on the same file? I have some data that is for each opened page....
assuming your db queries are
/myquery.asp?param=query1
/myquery.asp?param=query2
/myquery.asp?param=query3
then you change
makeRequest(theCheck.value +'.csv');
to
makeRequest("/myquery.asp? param="+th eCheck.val ue)
and change the html to
<form>
<span id="CName1div"><input type="checkbox" name="CName1" value="query1" onClick="ask(this)">1</spa n>
<span id="CName2div"><input type="checkbox" name="CName2" value="query2" onClick="ask(this)">2</spa n>
<span id="CName3div"><input type="checkbox" name="CName3" value="query3" onClick="ask(this)">3</spa n>
</form>
That is all.
The server process myquery.asp will then have to look at the parameter called param and execute the corresponding query.
It will then return the result as text/plain with linefeed between the text,value lines it produces
The csv files was just Comma Separated Values to test the process from static files
/myquery.asp?param=query1
/myquery.asp?param=query2
/myquery.asp?param=query3
then you change
makeRequest(theCheck.value
to
makeRequest("/myquery.asp?
and change the html to
<form>
<span id="CName1div"><input type="checkbox" name="CName1" value="query1" onClick="ask(this)">1</spa
<span id="CName2div"><input type="checkbox" name="CName2" value="query2" onClick="ask(this)">2</spa
<span id="CName3div"><input type="checkbox" name="CName3" value="query3" onClick="ask(this)">3</spa
</form>
That is all.
The server process myquery.asp will then have to look at the parameter called param and execute the corresponding query.
It will then return the result as text/plain with linefeed between the text,value lines it produces
The csv files was just Comma Separated Values to test the process from static files
theCheck.value+'.csv'
is the url of the request and it returns something like
val1,opt1
val2,opt2
val3,opt3