how to display jquery page(inside a div) using javascript?

前端 未结 3 966
伪装坚强ぢ
伪装坚强ぢ 2021-01-16 06:28

here is my problem, i call this method and what it does is

post some data on server using jQuery, i want to display page using result i recieve from server

m

相关标签:
3条回答
  • 2021-01-16 07:04

    try this..

    function loginPostData(jsonRequest)
        {
            $.post("http://localhost:8080/edserve/MobileServlet", 
                    JSON.stringify( jsonRequest), 
                    function(data) 
                    {
                        var obj = JSON.stringify(data);
                        //var object = JSON.parse(json_text);
                        //alert(obj);
                        alert(obj);
                        if(data.status=="success")
                        {
                            $.mobile.changePage( "#mainMenu"); // main menu div id..
                        }
                        else
                        {
                            if(data.message=="user not verified")
                            {
                                //display verification page
                            }   
                            if(data.message=="no user exist with this usname")
                            {
                                //set focus to username
                                $("#username").focus();
                            }   
                        }   
                }, "json");
        }
    
    0 讨论(0)
  • 2021-01-16 07:14

    You can try using the jquery load function for this http://api.jquery.com/load/

    0 讨论(0)
  • 2021-01-16 07:15

    try this code

     $.mobile.changePage( "#mainMenu", { allowSamePageTransition: true }); 
    

    and check this link

    http://jquerymobile.com/test/docs/api/methods.html

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