I am working with shiny server.
My application has a search box input. Based on that input, the output is a dataTable which has clickable links.
My application's ui.r contains a JavaScript function that sets the value of a variable whenever a link is clicked. Let the variable be clickedLink. Now I want to store this value of link to mysql or any other database. How to go about this?
I have tried ajax , php with no use. What I did is described in this question: saving json data to json file using ajax PHP but I guess php files do not work with shiny. Please help.
EDIT 1
code added to ui.R
tags$script(HTML("
function clickFunction(clickedLink){
//alert(clickedLink);
var cl = clickedLink;
Shiny.onInputChange('clickedLink',cl);
}
"))
code added to server.R
observe({
print(input$clickedLink)
})
EDIT 2
Just for information , the links are of the form
<a onclick="clickFunction(this.href); " target="_blank" href="http://SOMETING.com">SOMETHING</a>