php-b-grader php-b-grader - 1 year ago 154
Javascript Question

Javascript pass values using POST

I have a javascript function that uses to call another page and returning the result.

Here is the section of my code:

var windowFeatures = "status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=1, scrollbars=1"; ('' + encodeURIComponent(coords), 'JobWindow', windowFeatures);

My problem now is that I am passing to much data for the GET to handle and I need to pass it using the POST method.

How can I convert the code above to open the page using the POST method without implement forms all over the page (the page lists 100's of orders with a list of suppliers - I am trying to map the suppliers)

Answer Source

I used a variation of the above but instead of printing html I built a form and submitted it to the 3rd party url:

    var mapForm = document.createElement("form"); = "Map";
    mapForm.method = "POST"; // or "post" if appropriate
    mapForm.action = "";

    var mapInput = document.createElement("input");
    mapInput.type = "text"; = "addrs";
    mapInput.value = data;


    map ="", "Map", "status=0,title=0,height=600,width=800,scrollbars=1");

if (map) {
} else {
    alert('You must allow popups for this map to work.');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download