View Full Version : JS Help +REP
Dentafrice1
13-04-2007, 01:52 PM
I`m working with scriptaculous
<script src='scriptaculous/prototype.js'></script>
<script src='scriptaculous/scriptaculous.js'></script>
<script language="JavaScript" type="text/javascript">
var ajax;
function mydate2() {
ajax = new Ajax.Updater(
'datestr2', // DIV id must be declared before the method was called
'getdate.php?namde="'+document.test.hey.value+'"', // URL
{ // options
method:'post'
});
}
</script>
<form name="test">
<p><input type="text" name="hey" id="hey" onChange="mydate2();" size="20">
</form>
<div id="datestr2"></div>
The input goes to the JS which updates the datestr2 div with an image.
Why won't it pass my input via the url?
Any help gets rep
Drompo
13-04-2007, 02:01 PM
<script src='scriptaculous/prototype.js'></script>
<script src='scriptaculous/scriptaculous.js'></script>
<script language="JavaScript" type="text/javascript">
var ajax;
function mydate2() {
ajax = new Ajax.Updater(
'datestr2', // DIV id must be declared before the method was called
'getdate.php?namde="'+document.test.hey.value+'"', // URL
{ // options
method:'post'
});
}
</script>
<form name="test" method="get">
<p><input type="text" name="hey" id="hey" onChange="mydate2();" size="20">
</form>
<div id="datestr2"></div>
Try That
Dentafrice1
13-04-2007, 02:02 PM
Nope, the method is post...
Drompo
13-04-2007, 02:04 PM
Nope, the method is post...
Your Original Post
Why won't it pass my input via the url?
Passing data along a URL is get
Dentafrice1
13-04-2007, 02:07 PM
<script src='scriptaculous/prototype.js'></script>
<script src='scriptaculous/scriptaculous.js'></script>
<script language="JavaScript" type="text/javascript">
var ajax;
function mydate2() {
ajax = new Ajax.Updater(
'datestr2', // DIV id must be declared before the method was called
'getdate.php?name="'+document.test.hey.value+'"', // URL
{ // options
method:'get'
});
}
</script>
<form name="test" method="get">
<p><input type="text" name="hey" id="hey" onChange="mydate2();" size="20">
</form>
<div id="datestr2"></div>
I get that but when I input test, the URL is.
getdate2.php?name=\%22yea\%22?
Splinter
13-04-2007, 03:15 PM
If you are using special characters then the browser will convert them so just reconvert at the other end.
Ie..
<?php urldecode($_GET['name']); ?>
Dentafrice1
13-04-2007, 03:26 PM
Thanks +rep to you both, I dont need it anymore :P
Hxf Santa
13-04-2007, 03:26 PM
Hmm ill have a go now
Dentafrice1
13-04-2007, 03:29 PM
Urldecode doesn't fix it :\ hmm
<script src='scriptaculous/prototype.js'></script>
<script src='scriptaculous/scriptaculous.js'></script>
<script language="JavaScript" type="text/javascript">
var ajax;
function mydate2(page) {
ajax = new Ajax.Updater(
'datestr2', // DIV id must be declared before the method was called
'getdate.php?name="'+page+'"', // URL
{ // options
method:'get'
});
}
</script>
<form name="test" method="get">
<p><input type="text" name="hey" id="hey" onChange="mydate2(this.value);" size="20">
</form>
<div id="datestr2"></div>
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.