Created
October 7, 2010 21:56
-
-
Save jdsharp/615972 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>jQuery Mockjax Example Query string</title> | |
<script src="../lib/jquery-1.4.2.js"></script> | |
<script src="../jquery.mockjax.js"></script> | |
<script> | |
$.mockjax({ | |
url: '/rest', | |
data: { action: "foo" }, | |
responseText: { bar: "hello world" } | |
}); | |
$.mockjax({ | |
url: '/rest', | |
data: { action: "bar" }, | |
responseText: { bar: "hello world 2" } | |
}); | |
$.ajax({ | |
url: '/rest', | |
dataType: 'json', | |
data: { | |
action: "foo" | |
}, | |
success: function(json) { | |
$('body').append('Response 1: ' + ( json.bar || 'ERROR' ) + '<br>' ); | |
} | |
}); | |
$.ajax({ | |
url: '/rest', | |
dataType: 'json', | |
data: { | |
action: "bar" | |
}, | |
success: function(json) { | |
$('body').append('Response 2: ' + ( json.bar || 'ERROR' ) + '<br>' ); | |
} | |
}); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment