Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    May 2004
    Posts
    388
    Thanks
    73
    Thanked 0 Times in 0 Posts

    add variable to url?

    Why is this not working trying to add dateFieldName to url?



    //this alerts fine
    alert(dateFieldName)


    var TABLE = "<table width='400' height='400' class='dpTable'><tr><td><iframe src='/add-item?i=' + dateFieldName + ''></iframe> </td></tr></table>";

    // start generating the code for the calendar table
    var html = TABLE;
    alert(html);
    Last edited by nikko50; 06-08-2013 at 09:27 PM.

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,899
    Thanks
    15
    Thanked 226 Times in 226 Posts
    Code:
    var TABLE = "<table width='400' height='400' class='dpTable'><tr><td><iframe src='/add-item?i='" + dateFieldName + "'></iframe> </td></tr></table>";
    Should do it.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • #3
    Regular Coder
    Join Date
    May 2004
    Posts
    388
    Thanks
    73
    Thanked 0 Times in 0 Posts
    still no work. I can alert the variable but can't get it in the url. I'm stumped!

  • #4
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,899
    Thanks
    15
    Thanked 226 Times in 226 Posts
    Just make up a variable

    var friend ="smith";

    and put friend in, and see if that works.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • Users who have thanked DrDOS for this post:

    nikko50 (06-09-2013)

  • #5
    Regular Coder
    Join Date
    May 2004
    Posts
    388
    Thanks
    73
    Thanked 0 Times in 0 Posts
    ok Dr. It print in the alert not in the url. Could it have to do that I'm passing it to innerHTML?

    Code:
    function refreshDatePicker(dateFieldName)
    {
       var friend ="smith";
    
      
      var TABLE = "<table width='400' height='400' class='dpTable'><tr><td><a title='Close' href='#' onclick='closePicker(); return false;' > Close </a></td></tr><tr><td><iframe src='/add-item?i='" + friend + "'></iframe> </td></tr></table>";
      
      // start generating the code for the calendar table
      var html = TABLE;
    
    alert(html)
     
      document.getElementById(datePickerDivID).innerHTML = html;

  • #6
    Regular Coder
    Join Date
    May 2004
    Posts
    388
    Thanks
    73
    Thanked 0 Times in 0 Posts
    I got it!!

    var TABLE = "<table width='400' height='400' class='dpTable'><tr><td><a title='Close' href='#' onclick='closePicker(); return false;' > Close </a></td></tr><tr><td><iframe src=/add-item?i=" + dateFieldName + "></iframe> </td></tr></table>";

    THANKS FOR YOUR HELP DR.


  •  

    Posting Permissions

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