/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Reload after ajax request

I have a table list with multiple lines. At the bottom of the list there is regular text input fields to add a new line in the table.

The new line is added with a Ajax request. In this case I have no response, It just updates the database.

But I want the new line to show as the user adds it. If I take a type of javascript location.reload() it dont work when is done at the same time the ajax request is called.

location.reload() have to be called after the request is done.

Is it some way to reload the page after the ajax request is done or even better reload just the div that the list is in.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@KorFeb 26.2008 — But there is a contradiction within your aims. If you need to reload the page, that means you don't need AJAX, and you can use a simple classic submit to send/get data to/from the DB via a server-side application.
Copy linkTweet thisAlerts:
@kritroauthorFeb 26.2008 — I understand how you can say that, but I use Ajax to drag an drop sorting of the list, I use no form, no submit button, I update th database based on use of checkboxes etc.

But in this case I coldnt solve the problem without a page reload because my javascript skills is not the greatest.

Earlier I have showed the output from the Ajax Request in another div then where its comming from but this time I have to show the result in the same div and then I problaby have to rewrite the hole page to make it work so a page reload is okay.
×

Success!

Help @kritro spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...