Foreground js calls the background method example

  • 2020-03-30 00:42:06
  • OfStack

1. Background methods
 
public string AA(string cc) 

{ 

string dd = " Good is as good as good "; 

string message=dd+cc; 
return message; 

} 

The front desk JS

function Init() { 
var v = " China "; 
var s = '<%=AA("' + v + '") %>'; 
alert(s); 
} 

2. Post submission

Pvisajax.aspx for page processing

The data in {} is the parameter

Data is the data returned
 
$.post("PVISAjax.aspx", { Method: "PLANT", PlantName: plantName }, function (data) { 
if (data != null) { 
list = new Array(); //Character segmentation
list = data.split(","); 
var gfoN = list[0]; 
var grfoN = list[1]; 
var elN = list[2]; 
var ulN = list[3]; 
var etbaN = list[4]; 
gfo.SetValue(gfoN); 
grfo.SetValue(grfoN); 
exeuro.SetValue(elN); 
exusd.SetValue(ulN); 
etba.SetValue(etbaN); 
pvisName.SetValue(etbaN); 
etba.mainElement.title = etbaN; 
} 
}); 

The background

The Convert. ToString (Request [" PlantName "]); Receive the passed parameters

Related articles: