Following code is making call to a file ajax.php and it working perfectly on my localhost.
I want to use this Ajax code in my wordpress plugin but I could not figure it out in Wordpress format. I even study codex.wordpress.org but could not find it helpful.
If anyone can do that Please Help me regarding this issue.
Please do guide / help me in this issue. I'm waiting for your good guidance / instruction regarding this issue.
I want to use this Ajax code in my wordpress plugin but I could not figure it out in Wordpress format. I even study codex.wordpress.org but could not find it helpful.
If anyone can do that Please Help me regarding this issue.
Code:
<script type="text/javascript">
$(document).ready(function(){
load_options('','Make');
});
function load_options(id,index){
$("#loading").show();
if(index=="Model"){
$("#Year").html('<option value="">- Select Year -</option>');
}
$.ajax({
url: "ajax.php?index="+index+"&id="+id,
complete: function(){$("#loading").hide();},
success: function(data)
{
$("#"+index).html(data);
}
})
}
</script>
<div style="width:800px; margin:auto;padding-top:100px;">
<form>
<select id="Make" onchange="load_options(this.value,'Model');">
<option value="">- Select Make -</option>
</select>
&nbsp;&nbsp;&nbsp;
<select id="Model" onchange="load_options(this.value,'Year');">
<option value="">- Select Model -</option>
</select>
&nbsp;&nbsp;&nbsp;
<select id="Year">
<option value="">- Select Year -</option>
</select>
<img src="loader.gif" id="loading" align="absmiddle" style="display:none;"/>
</form>
</div>
Please do guide / help me in this issue. I'm waiting for your good guidance / instruction regarding this issue.