I am not able to send POST/Get requests using jquery. I have a python Flask server set up. Curl requests work perfectly. I could see requests hitting the server but these ajax requests not hitting the server. Below is the code i've been working on.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<script>
$(document).ready(function() {
$("#b1").click(function() {
$.ajax({
type: 'post',
url: 'http://np.mystiq.xyz/paste',
complete: function(response) {
$('#output').html(response.responseText);
},
error: function() {
$('#output').html('Bummer: there was an error!');
},
});
});
});
</script>
</head>
<body>
<button id="b1">test success </button>
<div id="output"/>
</body>
</html>
but this fiddle seems to work http://jsfiddle.net/zc59uLnc/ So issue is with JQuery. Not sure what exactly is the issue. Any help is much appreciated.