Transferring value from C # to jQuery

3

Well, I have a job in ASP.NET where I can upload music to a folder on the computer and I already have a function in C# to get the correct file address.

Anyway, I wanted to use this path in a music player in jQuery , how? Because it has the biggest gambiarra with database here, every song has already registered the path of it, so I needed a way to pull that path from C #.

Thank you in advance:)

    
asked by anonymous 12.06.2015 / 23:30

1 answer

1

As you have not shown the code, I do not know exactly how you are doing, but if you want to call a javascript function through CodeBehind it can be done like this:

var caminhoMusica = /* seja lá como você pega */
Page.RegisterClientScriptBlock("SeuScript","<SCRIPT Language='javascript'> alert(" + caminhoMusica + "); </SCRIPT>");

I used alert because it is an example only, adapt as you need it.

Although this solution works, it has been discontinued , see here .

    
13.06.2015 / 00:06