Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#getSomethingButton").click(function () {
- var username = "myusername";
- var password = "mypassword";
- $.ajax({
- url: 'people/getSomething',
- username: username,
- password: password,
- dataType: 'jsonp',
- jsonpCallback: 'onGetSomething'
- });
- });
- public string GetSomething(string callback)
- {
- string data = "{data: 'test'}";
- return string.Format("{0}({1});", callback, data);
- }
- // Obviously the username/password should not be hardcoded but read from an input
- $.get('/home/foo', { username: 'foo', password: 'secret' }, function(result) {
- alert('username/password sent');
- });
- public ActionResult Foo(string username, string password)
- {
- ..
- }
Add Comment
Please, Sign In to add comment