Prototype.js how to set a parameter dynamic??

Discussion in 'JavaScript' started by 123GoToAndPlay, Oct 23, 2007.

  1. #1
    I do get the right div but i can't get the randomID

    
    new Ajax.Updater('div-'+randomIDValue, '/edit-file.php', { method: 'post' , parameters: {randomID: '+randomIDValue+'}});
    
    Code (markup):
    any suggestions?
     
    123GoToAndPlay, Oct 23, 2007 IP
  2. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    new Ajax.Updater(
    		\'div-\'+randomID, 
    		\'/edit-file.php\', 
    		{ method: \'post\' , parameters: \'randomID=\'+randomIDValue
    		});
    
    Code (markup):
     
    123GoToAndPlay, Oct 24, 2007 IP
  3. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #3
    urm ...

    
    new Ajax.Updater( 'div-'+randomIDValue, '/edit-file.php', { method: 'post', parameters: { randomID: randomIDValue } } );
    
    HTML:
     
    krakjoe, Oct 24, 2007 IP
  4. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    @krokjoe, maybe i should have told you the code i posted is in php.

    So
    <?php

    $header .= '
    ...here the ajax javascript code....
    '
    ?>

    That's why i needed to escape ' and had problems with setting the parameters.
     
    123GoToAndPlay, Oct 25, 2007 IP