Rasika Sonar
Rasika Sonar

Reputation: 21

How to refresh a web page after submitting a form

m developing a website where you can search for any desired property by providing appropriate inputs. I am also providing a feature where you can take part in online auctioning of a property. I have provided one input box where you can set your bid and submit for your bid. on the top of that input box i am displaying the current highest bid which i am fetching from database. If the bid submitted by user is higher than the current highest bid then the line above the input box "Current highest bid is _" should automatically get updated. But as I have written the logic for fetching and displaying highest bid from database on the top of my page n have implemented the rest of the logic for updating the database at the bottom of the page, m facing few errors, somebody plz help me Thanks in advance

Upvotes: 1

Views: 637

Answers (3)

Jitendra
Jitendra

Reputation: 1117

there are two ways

1) just submit form to server without any ajax content.(it will be updated and loaded as default behavior)

2)use ajax(jQuery.load or jQuery.ajax will be easiest).

- submit form in the click method of jquery, 
- print bid status as  the response.
- Catch this response process it and update your data on page.
- to prevent page refresh, use event.preventDefault or return false at end of function

Upvotes: 0

Sumit Bijvani
Sumit Bijvani

Reputation: 8179

You can refresh your page with the help of JavaScript

location.reload();

Upvotes: 0

harikrishnan.n0077
harikrishnan.n0077

Reputation: 2087

If you want to refresh a webpage using php try this

header("Location:http://something/index.php");

Or if you want to get the highest bid from database periodically you will have to use AJAX.

Upvotes: 1

Related Questions