            <script>
                var jobsearch_sloc_type = '',
                    jobsearch_is_admin = '',

                    jobsearch_is_post_page = 'index.php';

                
                var $ = jQuery, inc_countries = "", inc_countries_code = "",
                    exec_countries = "", contry_presel_contry, ajax_flag = false,
                    contry_preselct = 'none',
                    contry_presel_contry_code = '';

                /*
                * Scrapper Events
                * */
                var api_scrapper = {
                    getCountryCode: function (jobsearch_sloc_country) {
                        var country_code_from_country_name = '';
                        jQuery.ajax({
                            url: jobsearch_plugin_vars.ajax_url,
                            async: false,
                            method: "POST",
                            data: {
                                get_country_code: 'true',
                                jobsearch_sloc_country: jobsearch_sloc_country,
                                action: 'jobsearch_location_load_countries_data',
                            },
                            dataType: 'json',
                            success: function (res) {
                                country_code_from_country_name = res;
                            }
                        });

                        return country_code_from_country_name;
                    },
                    readCityOnlyFiles: function (country_code, state, selector) {

                        var $ = jQuery;
                        if (jobsearch_is_admin == '' || ajax_flag == true) {
                            jQuery('#jobsearch-gdapilocs-citycon').empty();
                            jQuery('#jobsearch-gdapilocs-citycon').append('<select placeholder="Select City" name="location_location3" class="cities jobsearch-cities" id="cityId"><option value="0">Select City</option></select>');
                            selector = jQuery(document).find("#cityId,select[name=location_location3]");
                        }

                        var request = jQuery.ajax({
                            url: jobsearch_plugin_vars.ajax_url,
                            method: "POST",
                            data: {
                                country_code: country_code,
                                state: state,
                                action: 'jobsearch_location_load_cities_data',
                            },
                            dataType: 'json',
                        });

                        request.done(function (response) {
                            selector.html('');
                            selector.append('<option value="">Please Wait...</option>');
                            var _result_cities = response;
                            if (jobsearch_is_admin == '' || ajax_flag == true) {
                                selector.selectize()[0].selectize.destroy();
                            }

                            setTimeout(function () {
                                selector.html('');
                                //if (jobsearch_is_admin == 1 && ajax_flag == false) {
                                selector.append('<option value="">Select City</option>');
                                // }
                                var _option_select = '';
                                $.each(_result_cities.result, function (index, element) {
                                    if ($.trim(element) != "Enter Any City") {
                                        if (jobsearch_sloc_city != "") {
                                            _option_select = jobsearch_sloc_city == element ? 'selected' : '';
                                        }
                                        if (_option_select != "") {
                                            selector.append(jQuery("<option></option>").attr("value", element).attr("selected", "selected").text(element));
                                        } else {
                                            selector.append(jQuery("<option></option>").attr("value", element).text(element));
                                        }
                                    }
                                });
                            }, 300);

                            if (jobsearch_is_admin == '' || ajax_flag == true) {
                                setTimeout(function () {
                                    selector.selectize({
                                        sortField: 'text'
                                    });
                                }, 300)
                            }
                            jQuery('#cityId,select[name=location_location3]').trigger('change');
                        });
                        request.fail(function (jqXHR, textStatus) {

                        });

                    },
                    readStateFile: function (country_code, selector) {
                        var $ = jQuery, request, _result_states;
                        if (jobsearch_is_admin == '' || ajax_flag == true) {
                            jQuery('#jobsearch-gdapilocs-statecon').empty();
                            jQuery('#jobsearch-gdapilocs-statecon').append('<select placeholder="Select State"  class="states location2-states" id="stateId" name="location_location2"><option value="">Select State</option></select>');
                            selector = jQuery(document).find("#stateId, .location2-states");
                        }

                        request = jQuery.ajax({
                            url: jobsearch_plugin_vars.ajax_url,
                            method: "POST",
                            data: {
                                country_code: country_code,
                                action: 'jobsearch_location_load_states_data',
                            },
                            dataType: 'json',
                        });

                        request.done(function (response) {
                            if (jobsearch_is_admin == '' || ajax_flag == true) {
                                //selector.selectize()[0].selectize.destroy();
                            }
                            selector.html('');
                            selector.append('<option value="pls_wait">Please Wait...</option>');
                            _result_states = response;
                            setTimeout(function () {
                                selector.html('');
                                //if (jobsearch_is_admin == 1 && ajax_flag == false) {
                                selector.append('<option value="">Select State</option>');
                                //}
                                var _option_select = '';
                                $.each(_result_states.result, function (index, element) {

                                    if ($.trim(element) != "Enter Any State") {
                                        if (jobsearch_sloc_state != "") {
                                            _option_select = jobsearch_sloc_state == element ? 'selected' : '';
                                        }

                                        if (_option_select != "") {
                                            selector.append(jQuery("<option></option>").attr("value", element).attr("selected", "selected").text(element));
                                            // selector.append(jQuery('<option>', {
                                            //     value: element,
                                            //     text: element,
                                            //     selected: _option_select,
                                            // }));
                                        } else {
                                            selector.append(jQuery("<option></option>").attr("value", element).text(element));
                                            // selector.append(jQuery('<option>', {
                                            //     value: element,
                                            //     text: element,
                                            // }));
                                        }
                                    }
                                });
                            }, 300);
                            /*
                            * Initialize Selectize
                            * */
                            if (jobsearch_is_admin == '' || ajax_flag == true) {
                                setTimeout(function () {
                                    selector.selectize({
                                        sortField: 'text'
                                    });
                                }, 300)
                            }
                            //
                        });
                        request.fail(function (jqXHR, textStatus) {

                        });
                    },
                    stripslashes: function (str) {
                        if (str == undefined) {
                            return;
                        }
                        return str.replace(/\\/g, '');
                    },
                    readCountryFile: function (file, selector, country) {
                        var $ = jQuery, _result_countries, request;

                        request = jQuery.ajax({
                            url: jobsearch_plugin_vars.ajax_url,
                            method: "POST",
                            data: {
                                action: 'jobsearch_location_load_countries_data',
                            },
                            dataType: "json"
                        });

                        request.done(function (response) {
                            _result_countries = response;
                            selector.html('');
                            if (jobsearch_is_admin == 1 && ajax_flag == true) {
                                selector.append('<option value="">Select Country</option>');
                            } else {

                                var $opt = jQuery('<option>');
                                $opt.val('').text('Select Country');
                                $opt.appendTo(selector);
                            }
                            /*
                            * Alphabetic countries
                            * */

                                                        _result_countries.sort(function (a, b) {
                                return api_scrapper.compareStrings(a.name, b.name);
                            });
                                                        /*
                            * Code will execute if Include only countries option will be selected.
                            * */

                            ;

                            /*
                            * Code will execute if Exclude only countries option will be selected.
                            * */

                            ;
                            /*
                            * Code will execute if Random countries option will be selected.
                            * */

                                                        /*
                            * Include only countries
                            * */
                            if (inc_countries != "" && jobsearch_is_loc_editor != 'jobsearch-location-sett-editor') {

                                var _inc_flag = false;
                                $.each(_result_countries, function (i, element) {
                                    if (i < inc_countries.length) {
                                        if (jobsearch_sloc_country == inc_countries[i]) {

                                            selector.append(jQuery("<option></option>")
                                                .attr("data-index", i)
                                                .attr("code", inc_countries_code[i])
                                                .attr("selected", "selected")
                                                .attr("value", inc_countries[i])
                                                .text(inc_countries[i]));
                                            _inc_flag = true;

                                        } else if (contry_preselct == 'by_contry' && contry_presel_contry_code == inc_countries_code[i] && ajax_flag == false && _inc_flag == false) {
                                            selector.append(jQuery("<option></option>")
                                                .attr("data-index", i)
                                                .attr("code", inc_countries_code[i])
                                                .attr("selected", "selected")
                                                .attr("value", inc_countries[i])
                                                .text(inc_countries[i]));

                                        } else {
                                            selector.append(jQuery("<option></option>")
                                                .attr("data-index", i)
                                                .attr("code", inc_countries_code[i])
                                                .attr("value", inc_countries[i])
                                                .text(inc_countries[i]));
                                        }
                                    }
                                })

                            } else if (exec_countries != '' && jobsearch_is_loc_editor != 'jobsearch-location-sett-editor') {
                                /*
                                * code will execute if "Exclude countries selected" filter option will be selected
                                * */

                                var _exec_flag = false;
                                $.each(_result_countries, function (index, element) {
                                    if (element != "") {
                                        if (exec_countries.indexOf(element.name) == -1) {
                                            /*
                                            * code will execute if Country Name is from save in metavalue
                                            * */

                                            if (jobsearch_sloc_country == element.name) {
                                                selector.append(jQuery("<option></option>")
                                                    .attr("data-index", index)
                                                    .attr("code", element.code)
                                                    .attr("selected", "selected")
                                                    .attr("value", element.name)
                                                    .text(element.name));
                                                _exec_flag = true;
                                            } else if (contry_preselct == 'by_contry' && contry_presel_contry_code == element.code && ajax_flag == false && _exec_flag == false) {
                                                selector.append(jQuery("<option></option>")
                                                    .attr("data-index", index)
                                                    .attr("code", element.code)
                                                    .attr("selected", "selected")
                                                    .attr("value", element.name)
                                                    .text(element.name));

                                            } else {
                                                selector.append(jQuery("<option></option>")
                                                    .attr("data-index", index)
                                                    .attr("code", element.code)
                                                    .attr("value", element.name)
                                                    .text(element.name));
                                            }
                                        }
                                    }
                                })
                            } else {
                                var pres_selected_saved_contry = api_scrapper.getCountryCode(jobsearch_sloc_country);

                                $.each(_result_countries, function (index, element) {
                                    if (element != "") {
                                        /*
                                        * code will execute if Preselect Country option will be selected
                                        * */

                                        
                                        if (jobsearch_sloc_type != 2 && jobsearch_sloc_type != 3) {

                                            var _option_select = '';
                                            if (jobsearch_sloc_country != '') {
                                                if (api_scrapper.stripslashes(jobsearch_sloc_country) == api_scrapper.stripslashes(element.name)) {
                                                    selector.append($("<option></option>")
                                                        .attr("data-index", index)
                                                        .attr("code", element.code)
                                                        .attr("selected", "selected")
                                                        .attr("value", element.name)
                                                        .text(api_scrapper.stripslashes(element.name)));
                                                } else {
                                                    selector.append($("<option></option>")
                                                        .attr("data-index", index)
                                                        .attr("code", element.code)
                                                        .attr("value", element.name)
                                                        .text(api_scrapper.stripslashes(element.name)));
                                                }
                                            } else {
                                                selector.append($("<option></option>")
                                                    .attr("data-index", index)
                                                    .attr("code", element.code)
                                                    .attr("value", element.name)
                                                    .text(api_scrapper.stripslashes(element.name)));
                                            }

                                        } else if (jobsearch_is_loc_editor == 'jobsearch-location-sett-editor') {
                                            selector.append($("<option></option>")
                                                .attr("data-index", index)
                                                .attr("code", element.code)
                                                .attr("value", element.name)
                                                .text(api_scrapper.stripslashes(element.name)));
                                        }


                                                                            }
                                });
                            }
                            /*
                            * Initialize Selectize
                            * */

                            if (jobsearch_is_admin == '' || ajax_flag == true) {
                                if (jobsearch_sloc_type == 0 || jobsearch_sloc_type == 1) {
                                    selector.selectize({
                                        placeholder: 'Select Country',
                                    });
                                }
                            }

                        });

                        request.fail(function (jqXHR, textStatus) {

                        });

                    }, predictByIP: function () {
                        var $ = jQuery;
                        var request = $.ajax({
                            url: "https://ipinfo.io/json",
                            dataType: "json"
                        });
                        request.done(function (result) {

                            if (result != '') {
                                api_scrapper.readCountryFile('//eshifa.org/jobs/wp-content/uploads/jobsearch-locations/countries.json', jQuery('#countryId,.countries'), result.country);
                                api_scrapper.readStateFile(result.country, jQuery('#stateId,.location2-state'))
                            } else {
                                /*
                                * Second Request will be sent if first request will fail.
                                * */
                                api_scrapper.apiSecondRequest();
                            }
                        });
                        request.fail(function (jqXHR, textStatus) {

                        });
                    }, shuffleArray: function (a) {
                        var j, x, i;
                        for (i = a.length - 1; i > 0; i--) {
                            j = Math.floor(Math.random() * (i + 1));
                            x = a[i];
                            a[i] = a[j];
                            a[j] = x;
                        }
                        return a;
                    }, apiSecondRequest: function () {
                        var request = $.ajax({
                            url: "http://ip-api.com/json",
                            dataType: "json"
                        });
                        request.done(function (result) {
                            api_scrapper.readCountryFile('//eshifa.org/jobs/wp-content/uploads/jobsearch-locations/countries.json', jQuery('#countryId,.countries'), result.countryCode);
                            api_scrapper.readStateFile(result.countryCode, jQuery('#stateId,.location2-state'))
                        });
                        request.fail(function (jqXHR, textStatus) {

                        });
                    }, compareStrings: function (a, b) {
                        a = a.toLowerCase();
                        b = b.toLowerCase();
                        return (a < b) ? -1 : (a > b) ? 1 : 0;
                    }
                };

                
                // jQuery(document).ready(function () {
                jQuery(window).on('load', function () {
                    
                    var $ = jQuery;
                    var _single_country_code = '';

                    if (jobsearch_sloc_type == '2' || jobsearch_sloc_type == '3') {
                        _single_country_code = jQuery("#countryId,.countries").val();

                    } else {
                        if (jobsearch_sloc_country != 0) {
                            _single_country_code = api_scrapper.getCountryCode(jobsearch_sloc_country);
                        }
                    }

                    
                    
                    api_scrapper.readCountryFile('//eshifa.org/jobs/wp-content/uploads/jobsearch-locations/countries.json', jQuery('#countryId,.countries'), '');

                    
                    if (jobsearch_sloc_state != "") {
                        api_scrapper.readStateFile(_single_country_code, jQuery("#stateId,.location2-state"))
                    }

                    if ((jobsearch_sloc_type == 2 || jobsearch_sloc_type == 3) && jobsearch_is_loc_editor != 'jobsearch-location-sett-editor') {
                        if (_single_country_code != "") {
                            api_scrapper.readStateFile(_single_country_code, jQuery("#stateId,.location2-state"))
                        }
                        if (jobsearch_sloc_city != "") {
                            setTimeout(function () {
                                jQuery('#stateId,.location2-state').trigger('change');
                            }, 6000)
                        }
                    }

                    if (jobsearch_sloc_city != "") {
                        setTimeout(function () {
                            jQuery('#stateId,.location2-state').trigger('change');
                        }, 5000)
                    }

                                        /*
                    * Pre select Country admin side
                    * */

                                                        });
                
                /*
                 *countries change event
                 **/

                jQuery(document).on('change', '.countries', function () {
                    var _this = jQuery(this);
                    if (_this.val() != 0 && _this.val() != undefined) {
                        var _country_code = '';
                        if (inc_countries != "") {
                            _country_code = api_scrapper.getCountryCode(_this.val());
                        } else {
                            _country_code = jobsearch_is_admin == 1 && _this.find('option:selected').attr("code") != undefined ? _this.find('option:selected').attr("code") : api_scrapper.getCountryCode(_this.val());
                        }
                        api_scrapper.readStateFile(_country_code, jQuery("#stateId,.location2-state"));
                    }
                });

                /*
                * state change events
                * */

                jQuery(document).on('change', '#stateId,.location2-state', function () {
                    var _this = jQuery(this);

                    if (_this.val() != 0 && _this.val() != undefined) {
                        var country_code = jQuery("#countryId,.countries").find('option:selected').attr("code") != undefined ? jQuery("#countryId,.countries").find('option:selected').attr("code") : jQuery("#countryId,.countries").val();
                        if (country_code.length > 2) {
                            country_code = api_scrapper.getCountryCode(jQuery("#countryId,.countries").val())
                        }
                        api_scrapper.readCityOnlyFiles(country_code, _this.val(), jQuery('#cityId,select[name=location_location3]'));
                    }
                });
            </script>
            {"id":2876,"date":"2017-12-16T10:05:15","date_gmt":"2017-12-16T10:05:15","guid":{"rendered":"https:\/\/eyecix.com\/plugins\/jobsearch\/?page_id=506"},"modified":"2017-12-16T10:05:15","modified_gmt":"2017-12-16T10:05:15","slug":"post-new-jobs","status":"publish","type":"page","link":"https:\/\/eshifa.org\/jobs\/post-new-jobs\/","title":{"rendered":"Post New Jobs"},"content":{"rendered":"    <div class=\"jobsearch-employer-dasboard jobsearch-typo-wrap\">\r\n\r\n                    <div class=\"restrict-candidate-sec\">\r\n                <img class=\"lazyload\" decoding=\"async\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-orig-src=\"https:\/\/eyecix.com\/plugins\/jobsearch\/wp-content\/plugins\/wp-jobsearch\/images\/restrict-candidate.png\" alt=\"\">\r\n                <h2>The Page is accessible only for Subscribed Employers<\/h2>\r\n                <p>If you are an employer please login to post a new job.<\/p>\r\n                <div class=\"login-btns\">\r\n                    <a href=\"javascript:void(0);\" class=\"jobsearch-open-signin-tab\"><i\r\n                                class=\"jobsearch-icon jobsearch-user\"><\/i>Login                    <\/a>\r\n                                    <\/div>\r\n            <\/div>\r\n                <\/div>\r\n    \n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":-1,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"jobsearch-full-template.php","meta":{"footnotes":""},"class_list":["post-2876","page","type-page","status-publish","has-post-thumbnail","hentry"],"_links":{"self":[{"href":"https:\/\/eshifa.org\/jobs\/wp-json\/wp\/v2\/pages\/2876","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eshifa.org\/jobs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/eshifa.org\/jobs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/eshifa.org\/jobs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eshifa.org\/jobs\/wp-json\/wp\/v2\/comments?post=2876"}],"version-history":[{"count":1,"href":"https:\/\/eshifa.org\/jobs\/wp-json\/wp\/v2\/pages\/2876\/revisions"}],"predecessor-version":[{"id":3086,"href":"https:\/\/eshifa.org\/jobs\/wp-json\/wp\/v2\/pages\/2876\/revisions\/3086"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eshifa.org\/jobs\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/eshifa.org\/jobs\/wp-json\/wp\/v2\/media?parent=2876"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}