Welcome Guest, Not a member yet? Register   Sign In
Segment-based URL vs Query Strings
#3

Thanks for reply. I know about uri_to_assoc.

My problem was in allowed characters in config-file and I am unable to set in the name field value like "Hello World!" as encodeURIComponent does not encode !, ', (, ), and *.

My code

Code:
$('#button-filter').on('click', function() {

        var url = '<?php echo base_url('client'); ?>';

        var filter_name = $('input[name=\'filter_name\']').val();

        if (filter_name) {
                url += '/' + fixedEncodeURIComponent(filter_name);
        }

        var filter_filial = $('input[name=\'filter_filail\']').val();

        if (filter_filial) {
                url += '/' + encodeURIComponent(filter_filial);
        }

        var filter_rate = $('input[name=\'filter_rate\']').val();

        if (filter_rate) {
                url += '/' + encodeURIComponent(filter_rate);
        }

        var filter_status = $('select[name=\'filter_status\']').val();

        if (filter_status != "*") {
                url += '/' + encodeURIComponent(filter_status);
        }

        location = url;
});
So I thought about switching to query string approach.
But suddenly I have found the solution. Just small fix to encodeURIComponent.

https://developer.mozilla.org/en-US/docs...IComponent

P.S. I am not a coder but I LOVE CI! It's fantastic! :-)
Reply


Messages In This Thread
RE: Segment-based URL vs Query Strings - by wishmaster - 09-14-2015, 12:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB