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
Is there a way of getting the CurrentPage or nodeId within the WebApi controller, without sending it through the ajax call?
There is no CurrentPage when you call WebAPI
You can't get current page when you call WebAPI via js, you have to specify current page id via parameter passed
This is what I was trying to figure out. Didn't know if there was some magical way that I just couldn't find, so that I could drop sending it through the ajax call.
Often it's easier to just get the root node of the site and then "find" the node you want from there. Or hardcode the ID.
Hello, thank you for replying.
I need to figure out the exact page that sent the request, so I wouldn't know which instance of the document it would be, as searching from root could result in multiple documents matching the same criteria unless I specify the ID.
I've not tried this but would you be happy sending the URL of the current page in the request?
Then you could do (according to a quick Google - there might be a better way!)
I was trying to avoid sending it through parameteres in the request, as I feel it is unnecessary information to have in the front-end code.
However it was the solution I ended up doing, as of what I've researched there would be no other way as of now.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted