1
1
mirror of https://github.com/ariya/phantomjs.git synced 2024-09-17 15:47:09 +03:00
phantomjs/examples/post.coffee
James M. Greene e8380e42d7 Added CoffeeScript examples where missing, minor other fixes
Added CoffeeScript examples where missing, minor other fixes such as spacing standardization (2 spaces is the standard in CoffeeScript via Ruby). Also a small set of minor JS example fixes and additional comments.

Fixes http://code.google.com/p/phantomjs/issues/detail?id=907
2012-12-06 14:29:37 -06:00

13 lines
320 B
CoffeeScript

# Example using HTTP POST operation
page = require('webpage').create()
server = 'http://posttestserver.com/post.php?dump'
data = 'universe=expanding&answer=42'
page.open server, 'post', data, (status) ->
if status isnt 'success'
console.log 'Unable to post!'
else
console.log page.content
phantom.exit()