// jsvmpost
package spiderutil

import (
	"encoding/json"
	"io/ioutil"
	"log"
	"net/http"
	"net/url"
)

func JsVmPost(vmurl, jscript string) map[string]interface{} {
	resp, err := http.PostForm(vmurl,
		url.Values{"jscript": {jscript}})
	if err != nil {
		log.Println("JsVmPost", err, jscript)
	}

	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		// handle error
	}
	rep := map[string]interface{}{}
	json.Unmarshal(body, &rep)
	return rep
}
