I need an assignment done within 36 hours.
Basically, there is a webpage. It has a textbox and a combobox. Combobox's content is dependent on textbox.
Assume you have a country-city json file on server.
As you type to textbox, the html page should send an ajax call to server (what you have typed in box) and server will send you suggestions.
For example, in your text box, you typed 'a'. You should see suggestions like Angola, Argentina etc...
If you type 'r' after this, then you will have "ar" in textbox and you should only see countries that begin with "ar"
When you choose the country you want, page should send another request to server (this time the chosen country) and the server should respond back with the cities of chosen country.
In the end, if you have chosen Argentina, the combobox should be updated with cities of Argentina.
-----------------------
Requirements: No jquery, and code should be as simple as possible and commented.
Php can be used.
------------------------ TEMPLATE ---------------------
<html>
<head>
<script>
function suggest() {
var country= document.getElementById("textbox").value;
//// Here, make ajax calls and get respnse etc
}
</script>
</head>
<body>
<input id="textbox" type="text" onKeyUp="suggest( )" size="4">
</body>
</html>
This post was edited by findix on Dec 12 2013 04:56am