Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a partial view and that partial is a registration form. On my main view i have a button and on that button click i am opening that partial view in a pop up by jquery.(means getting html of partial view by jquery ajax and binding it in a div '#add' and opening this div in pop up)

On my main view , i have this form
@using (Ajax.BeginForm("SaveCountry", "Manage","Country", new AjaxOptions { HttpMethod = "POST",OnSuccess="okk" }, new { enctype = "multipart/form-data" }))
{

<div id="add" class="modal fade" tabindex="-1" data-width="780">
//Getting partial view here with a submit button it it
</div>

}

Now, above thing is not working. Onsuccess JS function Okk is not getting called.
Now if i make above form like this:
@using (Ajax.BeginForm("SaveCountry", "Manage","Country", new AjaxOptions { HttpMethod = "POST",OnSuccess="okk" }, new { enctype = "multipart/form-data" }))
{
<input type="submit" value="Click me">

}

then OnSuccess JS function Okk is working fine.

Does it mean that if in a form submit button is dynamically added by jquery then ajax onsuccess will not work or we have to find some other way.

What I have tried:

I tried nothing. Please suggest some answers.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900