Click to See Complete Forum and Search --> : variables via URL


catchup
05-19-2003, 02:40 PM
the below script passes in the browser as so:
Education.htm?age=10&data=

Would like it to pass as so:
Education.htm?age=10,(age=10)

I feel like i'm in a cunumdrum cause the script works when i use the POST method but the referring page (in this case Education.htm) gives this:
HTTP 405 - Resource not allowed
Internet Information Services

If I use the Get method then this happens:
Education.htm?age=10&data=

??what are my options??

script section:

var sum = parseInt(document.f1.age[j].value)+((!isNaN(val))?val:0);

var data = ",(age="+sum+")" ;

document.f1.action="Education.htm?age="+sum+data ;

full script:

<script type="text/javascript">
<!-- Begin

var itemchecked = false;
var checkRadios;
var data = "";

function checkRadios() {
var el = document.forms[0].elements;
for(var i = 0 ; i < el.length ; ++i) {
if(el[i].type == "radio") {
var radiogroup = el[el[i].name]; // get the whole set of radio buttons.

for(var j = 0 ; j < radiogroup.length ; ++j) {
if(radiogroup[j].checked) {
itemchecked = true;
break;
}
}
if(!itemchecked) {
alert("Please select an Age");
if(el[i].focus)
el[i].focus();
return false;
}
}
}
var sStr = document.location.search;
val = parseInt(sStr.substring(sStr.indexOf("=")+1,sStr.length));
var sum = parseInt(document.f1.age[j].value)+((!isNaN(val))?val:0);

if(itemchecked){
var data = ",(age="+sum+")" ;
document.f1.action="Education.htm?age="+sum+data ;
}
return true;
}
// End -->
</script>

khalidali63
05-19-2003, 03:13 PM
you can't unless you write some serious changes to the HTTP protocol that broser uses to pass the data from a age to another.

the default behaviour on get method is what you see in the browser address window.you should spend your time to write some code to parse the url..
and post will not work in this manner unless you are using a server side script.