Joshua5699
11/5/2013 - 11:59 PM

Appends a custom value to jQuery service calls. For use when you want to reset the client more or less whenever you like.

Appends a custom value to jQuery service calls. For use when you want to reset the client more or less whenever you like.

    <script type="text/javascript">
        $(document).ready(function () {
            $.ajaxSetup({
                beforeSend: function (xhr, settings) {
                    var qsValue = '?';
                    if (settings.url.indexOf('?') > 0) { qsValue = '&'; }
                    switch (settings.type) {
                        case "GET": settings.url += qsValue+'clientkey=x';
                        case "POST": settings.data += qsValue + 'clientkey=x';
                    }
                }
            });

        });
    </script>