How would you do it?

Discussion in 'Programming' started by Help Desk, Jun 27, 2005.

  1. #1
    You have a web application. This application wants the client to do some processing and data retrieval, on the click of a button, and send the results back to the server. The clincher is, there can be nothing installed on the client.

    Here is one solution...
    On button click, redirect to an html page that contains a javascript. Pass the needed parameters to this html page. The javascript then uses these parameters, does its function and redirects to a second another web page while passing the information to it via the url.

    For example...
    1. start.html
    2. submit form using GET method (jspage.html?param0=123&param1=abc)
    3. jspage.html <does calculation> and redirects to results.php?result0=123abc

    I'm fairly certain that I am not doing a good job explaining here.
     
    Help Desk, Jun 27, 2005 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Please define 'some processing and data retrieval'.

    Sounds like you're making it more complicated than it is or as you suggested, your explanation leaves room for interpretation.
     
    T0PS3O, Jun 27, 2005 IP
  3. Help Desk

    Help Desk Well-Known Member

    Messages:
    1,365
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    180
    #3
    The whole purpose is to offload some server data retrieval and processing without having to make an Applet or ActiveX control.
     
    Help Desk, Jun 27, 2005 IP
  4. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Something like a crawler but not using your server you mean?
     
    T0PS3O, Jun 27, 2005 IP
  5. Help Desk

    Help Desk Well-Known Member

    Messages:
    1,365
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    180
    #5
    Sort of. More like an XML feed though. I'm basically trying to search MSN's search results with a client application. I have a javascript that does so however what is the best way to pass in function arguments and get the results back.
     
    Help Desk, Jun 27, 2005 IP
  6. expat

    expat Stranger from a far land

    Messages:
    873
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #6
    here is an easier one
    just use php

    insert into body statement
    <?php
    if(!empty($redir)){
    echo"onLoad='docment.SecureForm.submit();'";
    }
    ?>

    The "SecureForm" form contains everything you need as hidden

    allows you to use get or post

    I use this all the time to do payment processing

    Expat
     
    expat, Jun 27, 2005 IP
  7. Help Desk

    Help Desk Well-Known Member

    Messages:
    1,365
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    180
    #7
    Good idea. However I will put a twist on it.

    This is what I am going to do now...

    From the start page you click the button/link to start the process.
    The web server creates and responds with a custom html page that contains the following...

    <script>
    var ProcessedValue="1234";//Really this will be something with much more processing.
    </script>
    
    <html>
     <body>
      <form name="hiddenform0" method="post" action="results.php">
       <input type=hidden name=name0>
      </form>
     </body>
    </html>
    
    <script>
    document.hiddenform0.name0.value = ProcessedValue;
    document.hiddenform0.submit();
    
    //The following two lines would also have worked.
    //document.forms[0].name0.value = ProcessedValue;
    //document.forms[0].submit();
    
    </script>
    Code (markup):
     
    Help Desk, Jun 27, 2005 IP