C
C#3y ago
Kamil Pisz

Jquery.load() with MVC how to load view when Exception appear

Jquery.load() with MVC how to load view when Exception appear
6 Replies
Kamil Pisz
Kamil PiszOP3y ago
im trying to implement dynamic load page in asp net core MVC with JQUERY
$("#product-info").load('@Html.Raw(Url.Action("ScanTempDeliveryItemOnModal2"),
$("#product-info").load('@Html.Raw(Url.Action("ScanTempDeliveryItemOnModal2"),
its fine but i have a problem when there is some error (status 500), i have costum Exception HTML view return in my app (throw new CustomReturnException()) and this is returned in this above method response but jquery.load didnt load this ;/ its there a way to just ignore not success in jquery.load and just load my error page?
Cisien
Cisien3y ago
if that js code is in a js file, it's not going to evaluate the @html directives
Kamil Pisz
Kamil PiszOP3y ago
its in my cshtml page in script sections
Kamil Pisz
Kamil PiszOP3y ago
so i get html in response
Kamil Pisz
Kamil PiszOP3y ago
i think its due to status 500 jquery.load return success == false and not continue to load
Cisien
Cisien3y ago
yeah you'll need to use $.ajax (I think it is) and handle it at a lower level unless load lets you pass in an error callback
Want results from more Discord servers?
Add your server