Knowledge Walls
John Peter
Pune, Maharashtra, India
How to redirect with get/post data in jquery custom method?
26069 Views
Example
<html>
    <head>
        <title>HTML-JQuery</title>
        <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
         
        <script type="text/javascript">
            function url_redirect(options){
                 var $form = $("<form />");
                
                 $form.attr("action",options.url);
                 $form.attr("method",options.method);
                
                 for (var data in options.data)
                 $form.append('<input type="hidden" name="'+data+'" value="'+options.data[data]+'" />');
                 
                 $("body").append($form);
                 $form.submit();
            }
            
            $(function(){
                /*jquery statements */
                url_redirect({url: "http://www.knowledgewalls.com",
                  method: "get",
                  data: {"q":"KnowledgeWalls"}
                 });
            });
        </script>
    </head>
    <body>
        <!-- HTML statements -->
         
    </body>
</html>
Demo 
Best Lessons of "One day One Thing to Know"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details