如何通过ajax生成动态网页

时间:2016-09-06 09:46:54

标签: javascript php jquery ajax html5



  <font style="color:#03C">Select PF Office State</font> &nbsp;&nbsp;
  <select name="state" id="state" onchange="generate_table();">
      <option value="select" >-- Select a State --</option>
            
      <!--<option value="AN">ANDAMAN AND NICOBAR ISLANDS</option>-->
      <option value="WB">ANDAMAN AND NICOBAR ISLANDS</option>
      <option value="AP">ANDHRA PRADESH</option>

            
      <!--<option value="AR">ARUNACHAL PRADESH</option>-->
      <option value="AS">ARUNACHAL PRADESH</option>      
      <option value="AS">ASSAM</option>
            
      <option value="BH">BIHAR</option>
            
      <!--<option value="CH">CHANDIGARH</option>-->
      <option value="PB">CHANDIGARH</option>     
      <option value="CG">CHATTISGARH</option>
            
      <option value="DN">DADRA AND NAGAR HAVELI</option>

            
      <option value="DD">DAMAN AND DIU</option>
            
      <option value="DL">DELHI</option>
            
      <option value="GA">GOA</option>
            
      <option value="GJ">GUJARAT</option>
            
      <option value="HR">HARYANA</option>
            
      <option value="HP">HIMACHAL PRADESH</option>

            
      <option value="JK">JAMMU AND KASHMIR</option>
            
      <option value="JR">JHARKHAND</option>
            
      <option value="KN">KARNATAKA</option>
            
      <option value="KL">KERALA</option>
            
      <!--<option value="LD">LAKSHADWEEP</option>-->
      <!--<option value="WB">LAKSHADWEEP</option>-->
      <option value="TN">LAKSHADWEEP</option>
            
      <option value="MP">MADHYA PRADESH</option>

            
      <option value="MH">MAHARASHTRA</option>
            
      <!--<option value="MN">MANIPUR</option>
            
      <option value="MG">MEGHALAYA</option>
            
      <option value="MZ">MIZORAM</option>
            
      <option value="NL">NAGALAND</option>-->
      <option value="AS">MANIPUR</option>
            
      <option value="AS">MEGHALAYA</option>
            
      <option value="AS">MIZORAM</option>
            
      <option value="AS">NAGALAND</option>
      
      <option value="OR">ORISSA</option>

            
      <!--<option value="PN">PONDICHERRY</option>-->
      <option value="TN">PONDICHERRY</option>
      <option value="PB">PUNJAB</option>
            
      <option value="RJ">RAJASTHAN</option>
            
      <!--<option value="SK">SIKKIM</option>-->
      <option value="AS">SIKKIM</option>     
      <option value="TN">TAMIL NADU</option>
            
     <option value="TS">TELANGANA</option>
	  <option value="AS">TRIPURA</option>
            
      <option value="UP">UTTAR PRADESH</option>
            
      <option value="UC">UTTARAKHAND</option>
            
      <option value="WB">WEST BENGAL</option>
</select>
  </p>
</div>
<br/>
<br/>



<div id="myDiv">

</div>
&#13;
<script type="text/javascript">
function generate_table()
{
	if(document.getElementById('state').value == "Select")
	{
		alert('Please select a state');
		return;
	}
	var state = document.getElementById('state').value;
	document.getElementById("myDiv").innerHTML = '<img src = "http://epfoservices.in/epfo/member_balance/images/preloader_bill.gif" style = "padding-bottom:600px; padding-left:300px;">';
	var XMLHttpRequestObject = false;
	if (window.XMLHttpRequest) {
	XMLHttpRequestObject = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
	XMLHttpRequestObject = new
	ActiveXObject("Microsoft.XMLHTTP");
	}
	
	if(XMLHttpRequestObject)
	{
		var url="http://epfoservices.in/epfo/member_balance/table.php?state="+state ;
		XMLHttpRequestObject.open("GET", url);
		XMLHttpRequestObject.onreadystatechange = function()
		{
		if (XMLHttpRequestObject.readyState == 4 &&
		XMLHttpRequestObject.status == 200)
		{
		  document.getElementById("myDiv").innerHTML=XMLHttpRequestObject.responseText;
		}
		}
		XMLHttpRequestObject.send(null);
	}
}

function MM_win5() { //v2.0
   //return eval(jsStr)
   var w = 650; // set the width of pop-up
   var h = 500; // set the height of pop-up
   var l = Math.floor((screen.width-w)/7);
   var t = Math.floor((screen.height-h)/2);
   //window.open(jsStr+"?identifier="+str,"pop","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
   window.open("office_list.php", "pop", 'width=650,height=500,scrollbars=yes, top=' + t + ',left=' + l);
}
</script>
&#13;
&#13;
&#13;

表格未从http://epfoservices.in/epfo/member_balance/table.php?state=加载,但图片加载请帮助任何人table.php?州代码用两位数字写

以及我希望通过向tablephp文件添加州代码来贷款的办事处列表

手动我可以通过将状态代码放到该php url

来获得结果

示例:http://epfoservices.in/epfo/member_balance/table.php?state=up

0 个答案:

没有答案