forked from ziogas/legacy-php-rest-api-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_cookie.php
34 lines (32 loc) · 1011 Bytes
/
test_cookie.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<html>
<head>
<title>Cookie test</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
function test(method, args) {
$.ajax({
type: method,
url: 'http://example.dev/api/v1.0/records/7.json',
processData: true,
crossDomain: false,
xhrFields: { withCredentials: true },
dataType: 'json',
data: args,
timeout: 60000,
success: function (response, general_msg) {
console.log(arguments);
},
error: function (data, general_error) {
console.log(arguments);
}
});
}
window.setTimeout(function(){
test('GET', {});
}, 500);
</script>
</head>
<body>
Launch this from same domain as api and see the console.
</body>
</html>