Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: how can i apply ajax for this code with out usage of data base & php?

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how can i apply ajax for this code with out usage of data base & php?

    Hi,
    Here my doubt is how can apply ajax for the following code?
    Here is the following JavaScript code.


    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    <script type="text/javascript">
    function setOptions(chosen) {
    var selbox = document.myform.opttwo;

    selbox.options.length = 0;
    if (chosen == " ") {
    selbox.options[selbox.options.length] = new Option('Please select one of the options above first',' ');
    }
    if (chosen == "1") {
    selbox.options[selbox.options.length] = new
    Option('first choice - option one','oneone');
    selbox.options[selbox.options.length] = new
    Option('first choice - option two','onetwo');
    }
    if (chosen == "2") {
    selbox.options[selbox.options.length] = new
    Option('second choice - option one','twoone');
    selbox.options[selbox.options.length] = new
    Option('second choice - option two','twotwo');
    }
    if (chosen == "3") {
    selbox.options[selbox.options.length] = new
    Option('third choice - option one','threeone');
    selbox.options[selbox.options.length] = new
    Option('third choice - option two','threetwo');
    }
    }
    </script>
    </head>
    <body>
    <form name="myform"><div align="center">
    <select name="optone" size="1"
    onchange="setOptions(document.myform.optone.option s
    [document.myform.optone.selectedIndex].value);">
    <option value=" " selected="selected"> </option>
    <option value="1">First Choice</option>
    <option value="2">Second Choice</option>
    <option value="3">Third Choice</option>
    </select><br> <br>
    <select name="opttwo" size="1">
    <option value=" " selected="selected">Please select one of the options above first</option>
    </select>
    <input type="button" name="go" value="Value Selected"
    onclick="alert(document.myform.opttwo.options
    [document.myform.opttwo.selectedIndex].value);">
    </div></form>
    </body>
    </html>


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,296
    Thanks
    180
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: how can i apply ajax for this code with out usage of data base & php?

    A javascript question in a java forum belongs in the "Other Programming Languages" section - I have moved your thread.

    apply ajax for the following code
    Define apply? AJAX is used to read another webpage: we don't know if/what data you wish to send to a webpage, how you wish to do so (GET/POST), what webpage you wish, and then what you wish to do (if anything) with the response. To receive help, I recommend posting a specific question about your problem, and wrapping your code in the appropriate tags to preserve formatting.

  3. #3
    Junior Member
    Join Date
    Jan 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how can i apply ajax for this code with out usage of data base & php?

    How can i write a program on j-query with ajax without usage of j-son.
    The program is in the type of "When we are selected a combo-box(drop-down list) then the related option of combo-box the data would be displayed".
    But the second displayed data would be is it called from text type file for the 1st input options of combo-box.

Similar Threads

  1. Application & Data base
    By chinchilla in forum Android Development
    Replies: 5
    Last Post: May 17th, 2013, 06:13 AM
  2. Replies: 0
    Last Post: March 11th, 2012, 04:57 PM