Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
340 views
in Technique[技术] by (71.8m points)

javascript - How to hide details in jquery ajax from browser page source

I am using jquery for all my ajax thing, I don't know if that is fine but I use that for now.
I have one text input when user type characters in it I call server side get some values and add them on the view.
Code that I use bellow works fine but I want to improve it a little.
How can I make this ajax call so that users that want to investigate my page source code can't see what I call here?
So basically I want to hide from page source what url, what type and data send I use here, is it possible?

$(function () {
        $("#txtSearch").keyup(function (evt) {        
            $.ajax({
                url: "/Prethors/Users/SearchUsers",
                type: "POST",
                data: "text=" + this.value,
                success: function (result) {
                    $("#searchResult").prepend("<p>" + result + "</p>");      
                }
            });
        });
    });
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

No, a user will always be able to figure out what calls you are making if you include it in javascript.

You can compress and minify the javascript, but a determined person will always be able to find your url calls.

Here's a js compression site, for example. http://jscompress.com/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...