Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I need to track when a user clicks play on a wistia embedded video. Basically I just need to write to a SQL DB the name of the video and the logged in user. I have everything built but I need to call the server side function from the javascript. Here is the script code:

<script>
    wistiaEmbed = Wistia.embed("zt4tf4py2t");
    wistiaEmbed.bind("play", function () {
    alert("Play"); // CALL C# FUNCTION HERE
    return this.unbind;
    });
 </script>

Thanks, Sam

share|improve this question
2  
Check out this Google search... –  neoistheone Sep 3 at 19:27
 
Yeah could you??? I did google it and found nothing. –  Sam Cromer Sep 3 at 19:29
 
I found that already, I dont want to use web services for this. –  Sam Cromer Sep 3 at 19:31
1  
Look at the "Related" questions in the bottom right of this page. They are filled with virtually identical questions. –  Graham Sep 3 at 19:57
 
@SamCromer It's literally impossible to invoke a server-side function from Javascript without using a web service of some sort. The question is whether it will be ad-hoc, using some standard technology, or proprietary but transparent. Ish. –  millimoose Sep 18 at 1:13

1 Answer

up vote 3 down vote accepted

The simplest solution would be to send a POST via ajax. If you're using JQuery, you could do something like this:

$.ajax('/your/url/here.aspx?videoId=1');

Then in your ASP.NET code, add a page that checks the request parameter and saves the information to your database. If you're using MVC, it would just be a controller action.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.