Created
April 7, 2017 04:01
-
-
Save myf/21fdb87ecc5bec531eb635886ea7038d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$(function () { | |
$("#b").click(testPOST); | |
var exportUrl = 'http://localhost:7801/'; | |
function testPOST() { | |
var options = { | |
"xAxis": { | |
"categories": ["Jan", "Feb", "Mar","Apr"] | |
}, | |
"series": [{ | |
"data": [101.1, 71.5, 106.4] | |
}] | |
}; | |
var send_json = { | |
"type": "image/png", | |
"width": 400, | |
"b64": true, | |
"options": options | |
}; | |
$.ajax({ | |
type: 'POST', | |
contentType: "application/json; charset=utf-8", | |
url: exportUrl, | |
data: JSON.stringify(send_json), | |
mimeType: "text/plain; charset=x-user-defined", | |
success: function (data) { | |
debugger; | |
console.log('get the file from relative url: ', data); | |
$('#container').html('<img src="data:image/jpeg;base64,' + data + '"/>'); | |
}, | |
error: function (err) { | |
console.log('error', err.statusText); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment