zod
zod

Reputation: 12427

How can I refresh a form JQuery

How can I refresh or reload a form using JQuery?

I am filling my form using session values. Using Jquery Post I unset session, but then the values are already filled in the form.

I am trying to reset all form values after un setting the session with the following code:

$('#form')[0].reset();   

Yet it is not working after the $post ajax call.

Upvotes: 9

Views: 57105

Answers (3)

Chitransh Mathur
Chitransh Mathur

Reputation: 1

If you are working in STRUTS-2.0 then you've to do like this for refreshing form reset:

<s:submit name="operation" value="Create Account" onclick="location.reload();" />

Upvotes: -1

Sarfraz
Sarfraz

Reputation: 382746

Note that browser settings also dictate this. Make sure that you have disabled any auto-form filling settings or any plugins.

Upvotes: -1

sabanito
sabanito

Reputation: 1501

Do you have this?

<form id="form">.....</form>

If you do, it should work. If you don't have an "id" for your form tag, you should use

$("form")[0].reset();

Upvotes: 11

Related Questions