javascript - Invalid regular expression flags error Partial View -
i have div in view upload partialview.
here code
<div id="right2" style=" border-style: solid; border-color: #1d69b4; border-radius: 10px;"> @html.partial("calendardefault") </div>
and button need change 1 partialview another
here button code
<button class="filled-button" onclick="myfunction()" style="background: #72c367">new appointment</button>
and js code load
<script> function myfunction() { $("#right2").load(@url.action("shedulenewappointment","calendar")); } </script>
but have below errors
myfunction not defined @ htmlbuttonelement.onclick (index:125) uncaught syntaxerror: invalid regular expression flags
how can fix it?
this example work me:
here code have created in cshtml file:
<script> $('#getdetails') .click(function() { $('#detailsplace').load('@url.action("getdetails", "home")'); }); </script> <table class="table"> @foreach (var item in model) { <tr> <td> <a href="#" id="getdetails">@html.displayfor(modelitem => item.description)</a> </td> </tr> } </table> <div id="detailsplace"></div>
/home/getdetails being interpreted regular expression, using "home" pattern , "getdetails" flags. that's invalid regular expression, hence error.
this code inside contoller:
[httpget] public actionresult index() { referencerepository test = new referencerepository(); var response = test.getparts("a"); return view(response); } public actionresult getdetails() { return partialview(); }
Comments
Post a Comment