jquery - PartialView rendering on new page -


in parent view called createadmin have html controls, button , div place holder partial view

@using (html.beginform()) {        <p style="padding-left: 920px;">         <button name="button" value="search" id="searchresultbtn">         search</button>     </p>     <div class="editor-field" id="searchresult">         //place holder partial view     </div> } 

when clicked on button "search" partial view should rendered dynamically inside

<div id="searchresult"><div> 

the jquery is

 $(document).ready(function () {     $("#searchresultbtn").click(function () {         $.get('/views/shared/_adminsearchresult.cshtml', function (data) {             $('#searchresult').html(data);         });     }); });     

my controller method

[httppost]     public actionresult createadmin(string button, administration admin)     {         if (button == "search")         {             var result = administration.getadministrationlist();             if (result.count() != 0)                 return partialview("_adminsearchresult", result);         }     } 

i have partial view in shared folder name _adminsearchresult.cshtml.

the problem partial view being render in new page instead of place suppose to. can please point out going worng.

this should read along these lines:

 $(document).ready(function (e) {     $("#searchresultbtn").click(function (e) {         e.preventdefault();         $("#searchresult").load('@url.action("createadmin")');     }); });     

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -