0

If i have script like this :

<script type="text/javascript" src="//www.gmodules.com/ig/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/100080069921643878012/facebook.xml&amp;up_useNewFB_p=1&amp;up_showPopUp2_p=true&amp;synd=open&amp;w=320&amp;h=500&amp;title=Facebook&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>

and i wanna to execute this script in specific time in my .cs code how to do this?

2
  • 3
    C# code runs on the server side, and that script will be loaded in the client side, in what "specific time" would you like it to run? Commented Mar 8, 2012 at 9:03
  • I check on some value in comes from the db and then i wanna to execute this script which will create a gadget in the required place on my page Commented Mar 8, 2012 at 9:06

3 Answers 3

1
string rowTestHide = @"<script type="text/javascript" src="//www.gmodules.com/ig/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/100080069921643878012/facebook.xml&amp;up_useNewFB_p=1&amp;up_showPopUp2_p=true&amp;synd=open&amp;w=320&amp;h=500&amp;title=Facebook&amp;
border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>";
ClientScript.RegisterStartupScript(this.GetType(),"rowTest", rowTestHide);
Sign up to request clarification or add additional context in comments.

Comments

1

Try out with following code,

Page.ClientScript.RegisterClientScriptInclude("MyScript", "<script type="text/javascript" src="//www.gmodules.com/ig/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/100080069921643878012/facebook.xml&amp;up_useNewFB_p=1&amp;up_showPopUp2_p=true&amp;synd=open&amp;w=320&amp;h=500&amp;title=Facebook&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>");

Comments

1

The only real way to do this at the moment (without using something like SignalR) is to implement a polling system.

You will have to have an Ajax call, that makes a request to your server every xxx seconds, using something like:

window.setTimeout(function(){ /* do ajax request */ }, 5000);

Which would run every 5 seconds.

If the desired result comes back from the DB, you'll have to then programatically inject the required script block into your page.

take a look at this: jQuery AJAX polling for JSON response, handling based on AJAX result or JSON content

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.