Here I've came across using WCF service and it's RESTclient in same application. But I have a question that, is there any way to restrict the url parameter of Ajax to view in browser's Page Source or console f12?

Here is simple Example:

<script type="text/javascript">
    var D = document;

    //get data function
    $(D).ready(getyearData());
    function getyearData() {
        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            url: 'Service1.svc/GetYears',
            dataType: "json",
            //async: false,
            success: function (data) {
                var a = data.GetYearsResult.Data;
                var response = $.parseJSON(a);
                $('#ddlYears').empty();
                var ddl = D.getElementById('ddlYears');
                var opt = D.createElement("option");
                opt.text = '--Select--';
                opt.value = 0;
                ddl.options.add(opt);
                for (i = 0; i < response.length; i++) {
                    opt = D.createElement("option");
                    opt.text = response[i]['holiday_date'];
                    opt.value = response[i]['holiday_date'];
                    ddl.options.add(opt);
                }
            },
            error: function (data) {
                alert('Error Occured');
            }
        });
    }
</script>

And, this function is able to view in Browser using ways mentioned above. Any possible way to hide the script tags or at least url in Ajax call, in ASP.NET, JQuery?

Related posts

Recent Viewed