Look, I have called an API using client. I have a button that I posted inside a form tag. Now, the issue I'm facing is that whenever I save the data, my page reloads.
Is there a way that the API call happens through Client without my page refreshing?"
Jignesh KumarPosted Dec 27, 2024, 4:45 AM
Hello Sorabh,
Without page load and Ajax call, you can use partial view in mvc application,
Please find solution below,
Create form inside a view
Jaish MathewsPosted Dec 27, 2024, 3:05 AM
To achieve a more seamless user experience, you need to implement partial page updates, where only the relevant section of the screen is refreshed rather than reloading the entire page. This can be accomplished using client-side technologies such as AJAX or modern solutions like WebSocket-based frameworks or WebAssembly applications (e.g., Blazor).
Without leveraging these technologies, the entire page will continue to refresh because traditional HTTP operates on a Request/Response model, leading to a full-page reload by default.
Sourabh DhimanPosted Dec 26, 2024, 5:45 PM
Jignesh I want to without ajax call.
Jignesh KumarPosted Dec 26, 2024, 5:37 PM
Hello Sourabh,
You can use ajax call or fetch with api endpoint which will resolve your issue,
Note : key points is you must need to add e.preventDefault() which will stop page from submit and reload.