简体   繁体   中英

How to redirect to html page in JavaScript

I want to retrieve values from SQLite database, bind those values and redirect to another html page. Page is not redirected when I run this app.

function getEmployees_success(tx, results)
{
    var len = results.rows.length;
    alert(len);

    var fname = document.getElementById("fname").value;
    alert(fname);
    var lname = document.getElementById("lname").value;
    if (len == 0)
    {
        tx.executeSql("INSERT INTO Login(firstName,lastName) values ('" + fname + "','" + lname + "')");
        db.transaction(getDetails);
    }
    alert("getting...");


    for (var i=0; i<len; i++)
    {
        alert(len);
        var employee = results.rows.item(i);
        $('#lbUsers1').append('<li><a href="../html/results.html" >' +
                '<p class="line1">' + employee.firstName + ' ' + employee.lastName + '</p>' +
                '</a></li>');
    }
}

location.href="second.html";

if you using jquery mobile means

 $.mobile.changePage("#loginpage");  
window.location = "../html/results.html"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM