if(!window.jQuery){
var script=document.createElement('script');
script.type="text/javascript";
script.src="path/to/jQuery";
document.getElementsByTagName('head')[0].appendChild(script);
}
jQuery(function(){
jQuery("#property_contact").validate({
rules: {
name: "required",
email: {
required: true,
email: true
},
phone: {
required: true,
minlength: 9,
maxlength: 14
}},
messages: {
name: "Please enter your Name",
phone: {
required: "Please provide a Phone Number",
minlength: "Your Phone number must be 10 characters long"
},
email: "Please enter a valid email address"
},
submitHandler: function(form){
formData=jQuery('#property_contact').serialize();
jQuery.ajax({
type:"POST",
url:ajaxScript.ajaxurl,
data:{
action:'inmolink_propertydetail_datapost',
formData:formData,
},
success: function(data){
jQuery('#contactform').html(data);
}});
}});
});
jQuery(document).ready(function($){
var sURLVariables=decodeURIComponent(window.location.search.substring(1)).split('&');
var sParameterName, i;
for (i=0; i < sURLVariables.length; i++){
sParameterName=sURLVariables[i].split('=');
if(sParameterName[0].search("\\[")!=-1){
var name=sParameterName[0].split("[");
jQuery('select[multiple][name="'+name[0]+'[]"] [value="'+sParameterName[1]+'"]').attr('selected','selected');
jQuery('select[multiple][name="search_location_2[]"] [value="costa-del-sol-east-benagalbon"]').attr('selected','selected');
}}
});
jQuery(document).ready(function(){
jQuery(document).on('change','#details',function(){
var form=jQuery(this);
form.find('input[type=submit]').each(function(e){jQuery(this).val(jQuery(this).data('label') + ' (...)') })
var q=jQuery(this).serialize() ;
console.log(q);
jQuery.ajax({
type:"POST",
url:ajaxScript.ajaxurl,
dataType: "json",
data:{
action:'GetInstantdResponse',
get_args:q,
},
success: function(data){
form.find('input[type=submit]').each(function(e){jQuery(this).val(jQuery(this).data('label') + ' ('+ data.count +')') })
}});
})
jQuery(document).on('change','#details.autosubmit',function(){
var form=jQuery(this);
form.submit();
})
jQuery("#someclass").click(function(e){
e.preventDefault();
e.stopPropagation();
});
});
jQuery(document).ready(function(){
jQuery('select[name="listing_type"]').on('change',function(){
var status=jQuery(this).val();
jQuery.ajax({
type:"POST",
url:ajaxScript.ajaxurl,
data:{action:'GetInstantdResponse',priceToggle:1,status:status},
success: function(togglePrice){
var togglePrice=JSON.parse(togglePrice)
if(togglePrice){
jQuery('#list_price_min').children('option').remove();
jQuery('#list_price_min').append(togglePrice.list_price_min);
jQuery('#list_price_max').children('option').remove();
jQuery('#list_price_max').append(togglePrice.list_price_max);
}}
});
});
});
jQuery(document).ready(function(){
jQuery('.inmoReset').on('click',function(){
var status='status';
jQuery.ajax({
type:"POST",
url:ajaxScript.ajaxurl,
data:{action:'GetInstantdResponse',priceToggle:1,status:status},
success: function(togglePrice){
var togglePrice=JSON.parse(togglePrice)
if(togglePrice){
jQuery('#list_price_min').children('option').remove();
jQuery('#list_price_min').append(togglePrice.list_price_min);
jQuery('#list_price_max').children('option').remove();
jQuery('#list_price_max').append(togglePrice.list_price_max);
}}
});
});
});
jQuery(document).ready(function(){
var val=jQuery("#search_location_2 option:first").text();
var valprop=jQuery(".PropertyType option:first").text();
var valloc=jQuery("#location option:first").text();
jQuery(".search_location_2")
.multiselect({
noneSelectedText: val,
selectedList:1,
})
.multiselectfilter();
jQuery(".PropertyType")
.multiselect({
noneSelectedText: valprop,
selectedList:1,
})
.multiselectfilter();
jQuery(".LocationType")
.multiselect({
noneSelectedText: valloc,
selectedList:1,
})
.multiselectfilter();
});
jQuery(document).on('click', '.inmoReset', function(){
jQuery('select[name="bedrooms_min"]').find('option:selected').removeAttr("selected");
jQuery('select[name="bathrooms_min"]').find('option:selected').removeAttr("selected");
jQuery('select[name="list_price_min"]').find('option:selected').removeAttr("selected");
jQuery('select[name="list_price_max"]').find('option:selected').removeAttr("selected");
jQuery('select[name="listing_type"]').find('option:selected').removeAttr("selected");
jQuery('select[name="location[]"]').find('option:selected').removeAttr("selected");
jQuery('select[name="search_location_1"]').find('option:selected').removeAttr("selected");
jQuery('select[name="search_location_2[]"]').find('option:selected').removeAttr("selected");
jQuery('select[name="type[]"]').find('option:selected').removeAttr("selected");
setTimeout(()=> {
jQuery('li.child-cls').hide();
}, 500);
});