var ajurl = "https://example.com/filename.php"; var datas = "name="+name; $.ajax({ type: "post", url: ajurl, dataType: "jsonp", username : "userNames", password : "encript-pwd", //myPassword crypted with <?php echo crypt('myPassword'); ?> data: datas, success: function(data, textStatus, xhr) { alert("ok"); }});