d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Ajax-javascript-json Assignment > O Fg
Add Reply New Topic New Poll
Member
Posts: 3,197
Joined: Aug 29 2006
Gold: 37.82
Dec 12 2013 04:49am
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
Member
Posts: 29,723
Joined: Jun 11 2007
Gold: 279.52
Dec 12 2013 09:46am
does ur teacher already have a database with all the countries and cities listed? because to be honest i dont want to look up every country and every city and enter them into a database.

and how much are you paying?
Member
Posts: 3,197
Joined: Aug 29 2006
Gold: 37.82
Dec 12 2013 11:30am
no he doesnt. But country is just an example. It can be a singer-song list or whatever. Purpose is not accuracy or coverage of data. i'll pm you

This post was edited by findix on Dec 12 2013 11:41am
Member
Posts: 3,197
Joined: Aug 29 2006
Gold: 37.82
Dec 12 2013 09:13pm
I have completed the assignment myself.
Member
Posts: 11,610
Joined: Oct 28 2008
Gold: 1,795.00
Dec 13 2013 08:33am
Quote (findix @ Dec 12 2013 09:13pm)
I have completed the assignment myself.


:hail:
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll