If I post this it will call the same url with the token, and Umbraco routes it to the surface controller.
Then I have an ajax call on the page to load another cart by calling the CartController
url: /umbraco/cart/loadcart
This will change the cart and then render the Component and return it to the javascript that will update some of the html without reloading the page.
The problem is that when the component is rendered this time, the request url is /umbraco/cart/loadcart and the BeginUmbracoForm will therefore post the surface call to this url.
I realise why this is (since the request url is this), but I need this to not do it. Is there any workaround for this?
Should I add a div with id "formcontent" inside the BeginUmbracoForm and only update the form content by ajax, keeping the original html form tag?
BeginUmbracoForm inside Component rendered from ajax call
I have a Component that renders a form When the page is renders for the first time i simply use the Component.InvokeAsync
Inside of this I have a BeginUmbracoForm that calls a surface controller
If I post this it will call the same url with the token, and Umbraco routes it to the surface controller.
Then I have an ajax call on the page to load another cart by calling the CartController
url: /umbraco/cart/loadcart
This will change the cart and then render the Component and return it to the javascript that will update some of the html without reloading the page.
The problem is that when the component is rendered this time, the request url is /umbraco/cart/loadcart and the BeginUmbracoForm will therefore post the surface call to this url. I realise why this is (since the request url is this), but I need this to not do it. Is there any workaround for this? Should I add a div with id "formcontent" inside the BeginUmbracoForm and only update the form content by ajax, keeping the original html form tag?
You can just hardcode the action parameter
Ok, and thanks for input.
I think I had the problem wrong. The actual problem is that the SaveCart method is returning Ok() in the end or CurrentUmbracoPage()
Even if I hardcode the Html.BeginUmbracoForm
On the ajaxload the action it will therefore be /umbraco/cart/loadcart
The Save will be called ok, but the CurrentUmbracoPage() will return /umbraco/cart/loadcart
is working on a reply...