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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HTTP Redirect Snafu

    Hello. I am a new forum member and a fairly inexperienced developer. I could really use some help on what I believe must be a very common function.

    My objective is to use javascript and cgi to search the O'Reilly book listings by keyword from a webpage hosted on my localhost. I could just use the O'Reilly webpage, however, I am trying to understand what goes on behind the scenes by using the API.

    I have tried to sort the code on the O'Reilly search pages without success.

    Overall, I am trying to declare a variable with a value of 'http://my.safaribooksonline.com/xmlapi/?mytoken=keyword' within a web form

    Where,
    - 'mytoken' is my O'Reilly issued token
    - 'keyword' is a user-input keyword on the

    Then, before sending data to my CGI script, I want to append the variable and the keyword so that it forms the complete URL so CGI can load it into my web browser.

    Basically, this is just an HTTP Redirect, but I cannot get it to work. Now, I do not want anyone to write my code for me. However, can someone validate my approach? Am I using the right tools (CGI and Javascript)? Or, would you recommend something else? I had tried PHP and also asp.net... but am lost there, too.

    Thank you very kindly.

  • #2
    Regular Coder dswimboy's Avatar
    Join Date
    Nov 2003
    Location
    mostly in Ann Arbor
    Posts
    458
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i don't understand what you're doing.

    you have a webform (on your localhost page) where you type in a keyword:
    Code:
    <form name="foo" action="myScript.cgi" method="post">
    <input type="text" name="keyword">
    <input type="submit">
    </form>
    what is your CGI script supposed to do?


    why can't you just use one webform like this:
    Code:
    <form name="foo" action="http://my.safaribooksonline.com/xmlapi/" method="get">
    <input type="text" name="token">
    <input type="submit>
    </form>
    i'm sure i'm off the mark, but i just don't understand what you're trying to do.
    "There is more than one way to do it."

  • #3
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very kindly for your reply. Yes, my description is confusing.

    Basically, I want to input text into a text box, click the submit button, have the text in the text box appended to a static URL, and then have the brower go to that URL.

    So, for example, if my static URL is: http://my.safaribooksonline.com/xmlapi/=.

    And, I enter 'XML' into my text box, I want the browser to go to http://my.safaribooksonline.com/xmlapi/=XML.

    Is CGI the right approach for that?

    Thank you.

  • #4
    Regular Coder dswimboy's Avatar
    Join Date
    Nov 2003
    Location
    mostly in Ann Arbor
    Posts
    458
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you can use an HTML form without any CGI to do this. Safari Books is doing all the CGI work necessary.

    here is a form.
    Code:
    <form name="foo" action="http://my.safaribooksonline.com/xmlapi/" method="get">
    <input type="text" name="token" value="XML">
    <input type="submit>
    </form>
    when you click submit your browser will go to: http://my.safaribooksonline.com/xmlapi/?token=XML
    the red part will change to whatever you enter in the text box.
    "There is more than one way to do it."

  • #5
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ah! Fabulous! You are a scholar and a gentleman! Thank you!


  •  

    Posting Permissions

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