Click here to Skip to main content
15,936,709 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I would like to run the script after getting data using ajax. Can anyone help on this?
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript">

var a=[null,null,null,null,null] ;
var b=[null,null,null,null,null] ;

$(function(){
  $('#btn1').click(
function(){
 $.ajax({
    url: "http://............../customtext.txt",
    type: "GET",
    dataType: "text",
    error: function(){
             alert('Error loading text')},
    success: function(txt){
    var xvar = txt.split(";");
    var type = xvar[0];
      switch(type){
 case 'a': a=xvar; break;
 case 'b': b=xvar; break;
 }
}});});});

$(function(){
  $('#btn2').click(
function(){
 $.ajax({
    url: "http://................../customtext.txt",     //  a;john;25;male;false
    type: "GET",
    dataType: "text",
    error: function(){
             alert('Error loading text')},
    success: function(txt){
    var xvar = txt.split(";");
    var type = xvar[0];
      switch(type){
 case 'a': a=xvar; break;
 case 'b': b=xvar; break;
 }
}});});});

var fx;
if(a[4]==false||b[4]==false) {fx=false}
else {fx=true}

var dx;
if(a[3]&&b[3]=="male") {dx="gay"}
else if(a[3]&&b[3]=="female") {dx="les"}
       else{dx="normal"}

alert(fx);
alert(dx);



</script>
<body>
<input type="button" value="확인" id="btn1" />
<input type="button" value="확인" id="btn2" />
</body>
</html>
Posted
Updated 27-Dec-11 18:31pm
v2

1 solution

Use this

this.ClientScript.RegisterStartupScript(this.GetType(), "%#######%", "ShowHide('Panel1');",true);

Try this, if any problem then tell me.
 
Share this answer
 
Comments
Member 8399347 28-Dec-11 0:59am    
Thank you for your help.
As I am only a beginner, I need bit more detail please.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900