Data passed to other pages via hyperlink is being cut off

后端 未结 3 895
面向向阳花
面向向阳花 2021-01-26 12:58

I have a form that contains 2

提交评论

  • 2021-01-26 13:32

    You need to encodeURIComponent the value for category before using it in a URL.

    $('#BusinessCreateCategory').change(function(){
    
        var category=$('#BusinessCreateCategory').val();
        var encoded = encodeURIComponent(category);
        window.location.href='getbusinesssubcategory.php?category='+encoded;
    
    });
    

    Ampersand is a special character that garbles the URL you are trying to pass. Encoding the value should allow you to treat it as a single value.

    0 讨论(0)
  • 2021-01-26 13:37

    There is a browser limit to how many characters can pass through. Do you have an example of the complete string that you are trying to pass? I would initially suspect that this could be an encoding issue.

    0 讨论(0)
  • 提交回复
    热议问题