electron/spec/fixtures/pages/jquery.html

22 lines
531 B
HTML
Raw Normal View History

<html>
<head>
<script src="../../static/jquery-2.0.3.min.js"></script>
</head>
<body>
<script>
window.ajax = (url, options) => {
return new Promise((resolve, reject) => {
options.url = url
options.success = (data, status, request) => {
resolve({data, status: request.status, headers: request.getAllResponseHeaders()})
}
options.error = (xhr, errorType, error) => {
reject(error ? error : new Error(`${xhr.status}`))
}
$.ajax(options)
})
}
</script>
</body>
</html>