Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi Support,
Please let me know What should be the URL in Ajax hit in user control?
I am doing like this but not working .
<script> $('.btn').click(function () { $.ajax({ url: "/usercontrols/ProductTemplate/test", type: "GET", dataType: "json", success: function (data) { var a = data; alert("success"); }, error: function () { alert("error"); } }); }); </script>
Getting error. I think may be url parameter is wrong.
UserControl and its code behind file is in usercontrol folder.
Usercontrol name is : "ProductTemplate" and method is "test"
Current verstion : 6.2.1
Any help would be appriciated.
Thanks.
Hi Sony,
I don't think you can directly call a UserControl by it's URL. You'll have to put the UserControl on a Web Page and call the Url of the page via your ajax request.
Thanks, Dan.
Hi sony
The UserControl won't have a direct Url that you can call it from clientside code and create a response.
You could put the UserControl into a page template and publish that page, will give a Url to make the request to.
Or you could create an UmbracoAPIController
https://our.umbraco.org/documentation/reference/routing/webapi/
which is designed to create an endpoint to make custom data available from Umbraco, ie to call from client side code.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
What should be the URL in Ajax hit in user control?
Hi Support,
Please let me know What should be the URL in Ajax hit in user control?
I am doing like this but not working .
Getting error. I think may be url parameter is wrong.
UserControl and its code behind file is in usercontrol folder.
Usercontrol name is : "ProductTemplate" and method is "test"
Current verstion : 6.2.1
Any help would be appriciated.
Thanks.
Hi Sony,
I don't think you can directly call a UserControl by it's URL. You'll have to put the UserControl on a Web Page and call the Url of the page via your ajax request.
Thanks, Dan.
Hi sony
The UserControl won't have a direct Url that you can call it from clientside code and create a response.
You could put the UserControl into a page template and publish that page, will give a Url to make the request to.
Or you could create an UmbracoAPIController
https://our.umbraco.org/documentation/reference/routing/webapi/
which is designed to create an endpoint to make custom data available from Umbraco, ie to call from client side code.
is working on a reply...