Assigning JavaScript variable to a Perl variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sasimca007
    New Member
    • Sep 2007
    • 129

    Assigning JavaScript variable to a Perl variable

    Hello friends,
    IN modperl we write perl with html,javascript and etc. when we are writing perl code in the middle of javascript and if we want to assign a javascript variable to a perl variable, how it is possible?(Witho ut using Ajax). Urgent friends
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Once the page has loaded, Perl doesn't run any longer, so if you want to set a Perl variable to a JavaScript one, you will need to reload the page with the JavaScript value attached to the URL or you can do a form submit with a hidden input field.

    Post some code as an example of what you're trying to do.

    Comment

    • sasimca007
      New Member
      • Sep 2007
      • 129

      #3
      Originally posted by acoder
      Once the page has loaded, Perl doesn't run any longer, so if you want to set a Perl variable to a JavaScript one, you will need to reload the page with the JavaScript value attached to the URL or you can do a form submit with a hidden input field.

      Post some code as an example of what you're trying to do.
      Friend,
      I don't want to be page refreshed also.
      function clk(frm)
      {
      var sel = document.frm.ca t.value;
      print <<HTML;
      $v = sel;
      HTML
      I am trying with this code, so it is not assigning.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        If you want to avoid a page refresh, you'll have to use Ajax or (i)frames. Perl cannot run on the same page once it's loaded in the way you want it to.

        Comment

        Working...