0

On mysite/build-order I have a long order code that I'm assembling using Javacsript and sending via _GET in the URL to a hook_menu page for processing.

It can be as long as this (or longer), and am sending it to the create-order page like this:

<script type="text/javascript">
    //...building code
    var orderCode = "sku:OR-4x4>qty:2>prc:55.00>nfo:OR-4x4,sku:CVR>qty:1>prc:50>nfo:OR-4x4,sku:PF>qty:15>prc:2>nfo:OR-4x4 (sdfsdfg),sku:EM>qty:2>prc:12.95>nfo:OR-4x4 (sdfsdfg),sku:SC>prc:25>qty:4>nfo:Some description,sku:DB>qty:10>prc:4>nfo:Some description,sku:ES>qty:10>prc:3>nfo:BlahBlah,sku:OR-4x4>qty:2>prc:55.00>nfo:OR-4x4,sku:CVR>qty:1>prc:50>nfo:OR-4x4,sku:PF>qty:15>prc:2>nfo:OR-4x4 (sdfsdfg),sku:EM>qty:2>prc:12.95>nfo:OR-4x4 (sdfsdfg),sku:SC>prc:25>qty:4>nfo:Some description,sku:DB>qty:10>prc:4>nfo:BlahBlah-visiondelimiter-Phasellus laoreet lorem vel dolor tempus vehicula. Curabitur blandit tempus ardua ridiculus sed magna. Quisque placerat facilisis egestas cillum dolore.-visiondelimiter-eventName";

    var url = '/create-order/' + orderCode;
    window.location.replace(url);
</script>

Ive implemented a hook_menu setup in my custom module called "create_order_menu" and it works fine.

function mymodule_create_order_menu($ordercode){

    // do stuff with $ordercode

}

It all works fine. The only problem is that the order code string passed through the URL can sometimes be twice as long and it trips a 404 Error in the mysite/create-order page. When I shorten the code, it works. When I lengthen it again, it breaks.

Is there a better way to send such a lengthy variable to my hook_menu page setup?

3

I would suggest that you consider some pretty substantial changes to how you're doing things.

I would recommend using an AJAX request, probably with POST rather than GET, and don't try to do the redirect. Just update the interface with a "success" message for the user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.