Jump to content

Very easy ajax question (I think...)


IER506

Recommended Posts

Good morning team. I'm a beginner in ajax and I've started reading tutorials for javascript/ajax/php and mysql scenarios from w3schools.org.

 

I've managed to understand the philosophy of this technology but I have a really simple question! I've tried to run the following script:

 

http://www.w3schools.com/PHP/php_ajax_database.asp

 

and I've done it succesfully. But I was wondering how can I display the results when the page loads! I mean how can I have for example a value

as default in my select option when the page loads for first time and display the appropriate results?

 

Thanks in advance!

Link to comment
Share on other sites

add this on the body: onLoad="showUser(defaultValue)", where defaultValue is the value that you want to see in the page:

 

like:

.........................

</script>

</head>

<body onLoad="showUser(defaultValue)">

 

<form>

<select name="users" onchange="showUser(this.value)">

<option value="">Select a person:</option>

..................

 

sorry my english is very bad

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.