Jump to content

Fetch info without reloading page (when clicking submit button - AJAX?)


kalender

Recommended Posts

Hi,

Need some help here again.

 

If you guys take a look at:

http://83.233.5.191/crurre/index.php

 

There is a field called "Personnummer". Fill this with:

440611-1890

Then press "Hämta personuppgifter"

 

It will then fetch/recieve some personal data and fill the correct fields.

 

 

But.. as you can see.

The number disappear when the site reloads, but the info fills in which is good at least. So how do I solve this? The number have to stay in the "Personnummer" field without reloading the whole page and still fill in the info.

 

 

	<h1>Registrering</h1>
<form action="index.php" method="post">
   	  <div class="input text">
	<label for="DataNum">Personnummer</label>
	<input type="text" name="personnr" id="data" value=""/>
    </div>
  <input type="submit" id="GetData" value="Hämta personuppgifter" />

 

Thats how the Personnummer (civic number) field and Hämta personuppgifter (get personal data) looks like.

 

 

Hmm hope you guys know how to fix this.. Please write it all simply. Im probably the no1 newbie in here.

 

 

 

Thanks in advance!!

 

Regards,

K

Link to comment
Share on other sites

  • 3 weeks later...

JavaScript is client side script, So it Caches more so when working with form data I have found. If your javascript populates form fields on document ready, or windows load, or a click of a button even, simply refreshing the page wont clear the data. However say you clicked on the address bar on your browser and hit enter or "go" the browser acts like its loading the page fresh and then you'll notice the fields may empty out. So in a sense its an optical illusion your suffering from thinking that its sticking when in reality its not. Grant it on reload any data in the form will still be useable, but its not adding anything new to those fields in a sense that its rerunning the query through your javascript again..

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.