Search
' + item.value + ''; } if (item.type == 'd') { inner_html = '
'; } if (item.type == 'h') { inner_html = '
'; } if (item.type == 't') { inner_html = '
'; } //var inner_html = ' ' + item.value + '-' + item.avatar + '-' + item.type + ''; return $("
") .data("item.autocomplete", item) .append(inner_html) .appendTo(ul); }; $('#Location_Text_Mobile').autocomplete({ source: function (request, response) { $.ajax({ url: "/Search/Location_Search", data: { Search: request.term }, type: "POST", success: function (data) { var loc = ''; for (var i = 0; i < data.Location_List.length; i++) { var item = data.Location_List[i]; loc = loc + '
'; } var cit = ''; for (var i = 0; i < data.City_List.length; i++) { var item = data.City_List[i]; cit = cit + '
'; } if (cit != '') { cit = '
' // + '
' // + '
' // + '
' // + '
' // + '
' // + '
' // + '
' // + '
'); }); $('#Location_Text_Mobile').val(Loca_Name + ' - ' + City_Name); //$("#Li_Mobile").html(''); } else if (Loca_Type == 'c') { $("#Location_Id_Hidden").attr("data-type", Loca_Type); $('#Location_Text_Mobile').val(City_Name); Load_URl(); //var C_N = myGetCookie("City_Name"); //while (C_N.indexOf(" ") >= 0) // C_N = C_N.replace(' ', '-'); //var url_Link = '/Doctor/' + C_N + ''; //$("#Li_Mobile").html('
' // + '
' // + '
' // + '
' // + '
' // + '
' // + '
' // + '
' // + '
'); //$("#Li_Mobile").html(''); } }) //$.get("/Search/Location_Cookie?Id=" + $(this).attr("data-val") + "Type=" + $(this).attr("data-type"), function () { //}); }) }); } }) } }) $('#search_text_mobile').autocomplete({ source: function (request, response) { $.ajax({ url: "/Home/Getlist", data: { term: request.term }, type: "POST", success: function (data) { var inner_html1 = ''; var C_N = myGetCookie("City_Name"); var L_N = myGetCookie("location_name"); response($.map(data, function (item1) { var item = { value: item1.Doctor_Name_temp, avatar: item1.SubCategory_Name, rep: item1.Doctor_Image, selectedId: item1.Doctor_id, type: item1.type, loc: item1.Location_name, UniqueString: item1.URL_String }; var inner_html = ''; if (item.type == 'a') { inner_html = '
' + item.value + ''; } if (item.type == 'd') { inner_html = '
' + item.value + '-' + item.avatar + ''; //inner_html = '
' + item.value + '-' + item.avatar + ''; } if (item.type == 'h') { inner_html = '
' + item.value + '-' + item.avatar + ''; //inner_html = '
' + item.value + '-' + item.avatar + ''; } inner_html1 = inner_html1 + '
'; })) $("#Li_Mobile").html(inner_html1); //$('.a.ui-menu-item:first').prepend('Speciality'); //$('.d.ui-menu-item:first').prepend('Doctors'); //$('.h.ui-menu-item:first').prepend('Hospitals'); } }) } }) var Getthis = ''; $('#Location_Text_Desktop').autocomplete({ minLength: 0, source: function (request, response) { $.ajax({ url: "/Search/Location_Search", data: { Search: request.term }, type: "POST", success: function (data) { var obj_full = []; $.map(data.City_List, function (item) { obj_full.push({ value: item.City_Name, selectedId: item.City_id, type: 'C', }); }); $.map(data.Location_List, function (item) { obj_full.push({ value: item.Location_Name, selectedId: item.Location_id, City_Name: item.City_Name, City_Id: item.City_id, type: 'L', }); }); response(obj_full); //response($.map(data.Location_List, function (item) { // return { // value: item.Location_Name, // selectedId: item.Location_id, // City_Name: item.City_Name, // City_Id: item.City_id, // type: 'L', // }; //})); //response($.map(data.City_List, function (item) { // return { // value: item.City_Name, // selectedId: item.City_id, // type: 'C', // }; //})) var posLeft = $('#Location_Text_Desktop').offset().left - ($('#search_text').offset().left + 32), elwidth = $('#Location_Text_Desktop').parent().width() - 2; $('.C.ui-menu-item:first,.L.ui-menu-item:first').parent().css({ left: posLeft, minWidth: elwidth }); $('.C.ui-menu-item:first').prepend('City'); $('.L.ui-menu-item:first').prepend('Location'); //$('.h.ui-menu-item:first').prepend('Hospitals'); } }) }, select: function (event, ui) { //Load(); //function Load() //{ $('.topsearch').find('.ui-autocomplete').css("display", "none"); } //$(".ui-autocomplete").css("display", "none"); if (ui.item.type == 'L') { $.get("/Home/Change_City_Id?C_Id=" + ui.item.City_Id + "&C_Name=" + ui.item.City_Name + "&L_Name=l&L_Id=0", function () { $.get("/Home/Change_location", { "loc_id": ui.item.selectedId, "loc_name": ui.item.value }, function (data) { SetCookie("Hamburger", "1", 1); // location.href = document.URL; //alert(Getthis) //alert(ui.item.City_Name.replace(" ", "-")) //alert(ui.item.value.replace(" ", "-")) var Current_Url = ''; if (Current_Url != "") { location.href = Current_Url.replace("_YYY_", ui.item.value.replace(" ", "-")).replace("_ZZZ_", myGetCookie("City_Name").replace(" ", "-")); } else { location.href = "/"; } myGetCookie("City_Name"); //if (Getthis == "3") { // location.href = "/Doctor/" + ui.item.City_Name.replace(" ", "-") + "/" + ui.item.value.replace(" ", "-") + ""; //} }) }) } else if (ui.item.type == 'C') { $.get("/Home/Change_City_Id?C_Id=" + ui.item.selectedId + "&C_Name=" + ui.item.value + "&L_Name=c&L_Id=0", function () { SetCookie("Hamburger", "1", 1); //location.href = document.URL; var Current_Url = ''; if (Current_Url != "") { location.href = Current_Url.replace("_ZZZ_", ui.item.value.replace(" ", "-")); } else { location.href = "/"; } //if (Getthis == "1") { // location.href = "/Doctor/" + ui.item.value.replace(" ", "-") + ""; //} //else if (Getthis == "2") { // location.href = "/Doctor/" + ui.item.value.replace(" ", "-") + ""; //} //else { // location.href = "/Home"; //} }) } return false; } }).data("autocomplete")._renderItem = function (ul, item) { var inner_html = ''; if (item.type == 'L') { inner_html = ' ' + item.value + ' -' + item.City_Name + ''; } if (item.type == 'C') { inner_html = '' + item.value + ''; } //var inner_html = ' ' + item.value + '-' + item.avatar + '-' + item.type + ''; return $("
") .data("item.autocomplete", item) .append(inner_html) .appendTo(ul); }; Load_URl(); function Load_URl() { var url_Link1 = ""; var C_N1 = myGetCookie("City_Name"); while (C_N1.indexOf(" ") >= 0) C_N1 = C_N1.replace(' ', '-'); var L_N_Id1 = myGetCookie("location_id"); var L_N1 = myGetCookie("location_name"); while (L_N1.indexOf(" ") >= 0) L_N1 = L_N1.replace(' ', '-'); if (L_N_Id1 == "0") { $('#Location_Text_Mobile').val(C_N1); //$('#Location_Text_Desktop').val(C_N1); $('#Location_Text_Desktop, #Location_Label_Desktop span').attr("title", C_N1); $('#Location_Label_Desktop span').html(C_N1); url_Link1 = '/Doctor/' + C_N1 + ''; } else { $('#Location_Text_Mobile').val(L_N1 + ' - ' + C_N1); //$('#Location_Text_Desktop').val(L_N1 + ' - ' + C_N1); $('#Location_Text_Desktop, #Location_Label_Desktop span').attr("title", L_N1 + ' - ' + C_N1); $('#Location_Label_Desktop span').html(L_N1 + ' - ' + C_N1); url_Link1 = '/Doctor/' + C_N1 + '/' + L_N1; } $("#Li_Mobile").html('
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
'); } });/*This is for getting geo location to find Country*/function Nearby_LocationNew() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPositionNew, errorHandler, { timeout: 60000 }); } else { alert("Geolocation is not supported by this browser."); }}//alert(myGetCookie("cntry"))if (myGetCookie("cntry") == "") { // alert("Again Coming"); Nearby_LocationNew();}//Nearby_LocationNew();function showPositionNew(position) { $.get("/Home/Get_Nearby_new?Lat=" + position.coords.latitude + "&Lon=" + position.coords.longitude + "", function (data_loca) { if (data_loca.Success == "S") { $.get("/Home/Change_City_Id?C_Id=" + data_loca.City_Id + "&C_Name=" + data_loca.City_Name + "&L_Name=" + data_loca.Location_Name + "&L_Id=" + data_loca.Location_id + "", function () { //alert(data_loca.Country_id + "-" + data_loca.Country_Name); console.log(data_loca.Country_id + "-" + data_loca.Country_Name); location.reload(); }); } else { alert("Nearby Location Not Found"); } })}/*End*/function Nearby_Location() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition, errorHandler, { timeout: 60000 }); } else { alert("Geolocation is not supported by this browser."); }}$('.Current_Location').click(function () { Nearby_Location();});function showPosition(position) { //alert(position.coords.latitude) //alert(position.coords.longitude) SetCookie("Latitude_Near", position.coords.latitude, 1); SetCookie("Longitude_Near", position.coords.longitude, 1); $.get("/Home/Get_Nearby?Lat=" + position.coords.latitude + "&Lon=" + position.coords.longitude + "", function (data_loca) { if (data_loca.Success == "S") { SetCookie("Latitude_Near_Check", "1", 1); if ($(window).width() > 768) { $("#search_text").trigger("focus"); } $('.searchdrop').hide(); $.get("/Home/Change_City_Id?C_Id=" + data_loca.City_Id + "&C_Name=" + data_loca.City_Name + "&L_Name=" + data_loca.Location_Name + "&L_Id=" + data_loca.Location_id + "", function () { $.get("/Home/Change_location", { "loc_id": data_loca.Location_id, "loc_name": data_loca.Location_Name }, function (data) { var lat_near = myGetCookie("Latitude_Near"); var lon_near = myGetCookie("Longitude_Near"); var url_Link = '/List/GeoLocation_List?Lat=' + lat_near + '&Lon=' + lon_near + '&specialization='; $("#Li_Mobile").html('' + '
' + '
' + '
' + '
Bariatric Surgeon' + '
' + '
' + '
' + '
'); }); }); $("#Location_Id_Hidden").attr("data-type", "Near_By"); $('#Location_Text_Mobile').val(data_loca.Location_Name); $('#Location_Text_Desktop').val(data_loca.Location_Name); $('#Location_Label_Desktop span').html(data_loca.Location_Name + ' - ' + data_loca.City_Name); } else { alert("Nearby Location Not Found"); } })}function errorHandler(err) { if (err.code == 1) { // alert("Error: Access is denied!"); } else if (err.code == 2) { // alert("Error: Position is unavailable!"); }} $(document).ready(function () { $('#Location_Label_Desktop').click(function () { $("#Location_Text_Desktop").show(); $("#Location_Text_Desktop").trigger("focus"); $("#Location_Text_Desktop").trigger("click"); $("#Location_Label_Desktop").hide(); }); $('#Location_Text_Desktop').blur(function () { $("#Location_Text_Desktop").hide(); $("#Location_Label_Desktop").show(); });})