Results 1 to 10 of 10

Thread: JS Help +REP

  1. #1
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default JS Help +REP

    I`m working with scriptaculous

    Code:
            <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

  2. #2
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    Code:
    <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


  3. #3
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    Nope, the method is post...

  4. #4
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    Quote Originally Posted by Dentafrice View Post
    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


  5. #5
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    Code:
    <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=\&#37;22yea\%22?

  6. #6
    Join Date
    Nov 2005
    Posts
    807
    Tokens
    1,335

    Latest Awards:

    Default

    If you are using special characters then the browser will convert them so just reconvert at the other end.

    Ie..
    PHP Code:
    <?php urldecode($_GET['name']); ?>
    Last edited by Splinter; 13-04-2007 at 03:19 PM.

  7. #7
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    Thanks +rep to you both, I dont need it anymore

  8. #8
    Join Date
    Jul 2006
    Location
    yer mums room. ;)
    Posts
    2,703
    Tokens
    0

    Latest Awards:

    Default

    Hmm ill have a go now

  9. #9
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    Urldecode doesn't fix it :\ hmm

  10. #10
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    <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>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •