kalender Posted March 10, 2011 Share Posted March 10, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/230246-fetch-info-without-reloading-page-when-clicking-submit-button-ajax/ Share on other sites More sharing options...
sunfighter Posted March 26, 2011 Share Posted March 26, 2011 Your site 'http://83.233.5.191/crurre/index.php' is not loading. And you have posted in the wrong section. This is a php problem. When "Hämta personuppgifter" is pressed the number you want to preseave is sent as $_POST['personnr'] to index.php. This is what you need to send back to the displayed page. and I can't see that, it wont load. Quote Link to comment https://forums.phpfreaks.com/topic/230246-fetch-info-without-reloading-page-when-clicking-submit-button-ajax/#findComment-1192646 Share on other sites More sharing options...
monkeytooth Posted March 26, 2011 Share Posted March 26, 2011 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.. Quote Link to comment https://forums.phpfreaks.com/topic/230246-fetch-info-without-reloading-page-when-clicking-submit-button-ajax/#findComment-1192674 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.