I want to display result of this javascript in a label control on my asp.net page, instead of alert. how can i do so?
<script type="text/javascript" language="Javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <!-- Require EasyJQuery After JQuery --><script type="text/javascript" language="Javascript" src="http://api.easyjquery.com/easyjquery.js"></script> <script type="text/javascript" language="Javascript">
// 1. Your Data Here
function my_callback(json) {
alert("IP :" + json.IP + " COUNTRY: " + json.COUNTRY);
}
function my_callback2(json) {
alert("IP :" + json.IP + " COUNTRY: " + json.COUNTRY + " City: " + json.cityName + " Region Name: " + json.regionName);
}
// 2. Setup Callback Function
// EasyjQuery_Get_IP("my_callback"); // fastest version
EasyjQuery_Get_IP("my_callback2","full"); // full version
</script>
Using Dynamic ID
The label control of asp.net is rendered by default as
spanSo you can set the text inside by find this control by ID, and type inside using thetextas:Using Static ID
alternative (ver 4+) you can set
ClientIDMode="Static"on your control so the id not changerender as
<span id="txtName">Test</span>and write inside him asYour function will then be