[mapserver-users] html and ajax query
Jay Kapalczynski
jkapalczynski at ci.maple-grove.mn.us
Fri Dec 4 12:21:15 PST 2009
I am trying to get the user to choose from 2 comboboxes...cant seem to get this to work.......maybe someone out there can see something I am doin wrong?
I think this how it works? Using the code below
The user selects two values in combo boxes ("PriceFactor and PriceArea")
Click the button to call function "ReturnQueryResults"
The Array is built from the values of the two dropdown boxes ("id = PriceFactor" and "id = PriceArea") using their ID values
The javascript call is made that calls Ajax page which sends the php page the array of values. I then have to parse the ID (the array) with "Get" in the php page, formatting the output, which is then shown on the target specified in the Ajax page.
The results go back to the back to the ajax page
I don't have a great understanding of this...trying with a couple dropdowns to start.
Any help would be greatly appreciated...I think I am pretty close but can use another set of eyes...
THanks
HTML PAGE:
<p><b>Please Choose Price Factor:</b><br>
<select name="PriceFactor" id="PriceFactor">
<option value=""></option>
<option value="greaterthan">Greater Than</option>
<option value="lessthan">Less Than</option>
<option value="between">Between</option>
<option value="equalto">Equal To</option>
<option value="greaterthanequalto">Greater Than Equal To</option>
<option value="lessthanequalto">Less Than Equal To</option>
</select>
<p><b>Please Choose Area:</b><br>
<select name="PriceArea" id="PriceArea">
<option value=""></option>
<option value="100">100</option>
<option value="500">500</option>
<option value="700">700</option>
</select>
<input type="button" value="Send to Ajax and Tab" onClick="ReturnQueryResults();">
<br>
<br>
<script type="text/javascript">
function ReturnQueryResults() {
var url = " PropertyQuery3?";
var input_values_to_append = new Array('PriceFactor','PriceArea');
for(var i = 0; i < input_values_to_append.length; i++) {
url += '&'+input_values_to_append[i].name+'='+input_values_to_append[i].value;
}
javascript:getResulthype('url')
}
</script>
AJAX Page:
function getResulthype(url){
var _target = 'content_details_form';
if (id.length == 0) {
document.getElementById(_target).innerHTML="<b>No Information Available</b>";
return;
}
xmlHttp = GetAJAXObject();
if (xmlHttp==null) {
alert ("Unable to process your request, your browser does not support AJAX!");
return;
}
var url = "http://127.0.0.1:80/webapp/php/"+url+";
xmlHttp.onreadystatechange = showResult;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20091204/40673dc3/attachment.htm>
More information about the MapServer-users
mailing list