/ / link da una pagina html ad un'altra usando jQuery [closed] - jquery, html

link da una pagina html ad un'altra usando jQuery [closed] - jquery, html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="/Users/skhare/myFirstStyleSheet.css">

<script>
$(document).ready(function() {
$("#name").click(showTables(a){
alert(a);
});
});

</script>
</head>

<body>s
<div id="placeholder"></div>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>

<script>
$.getJSON("/Users/skhare/reportSuiteList.json",   function(reportSuiteList) {
var output="<table id=tableStyle>";
output+="<tr>" + "<th>" + "id" + "</th>" + "<th>" + "name" + "</th>" + "<th>" + "stage" + "</th>" + "<th>" + "DWH" + "</th>" + "</tr>";
for (var i in reportSuiteList.suites)
{
output+="<tr>" + "<td>" + reportSuiteList.suites[i].REPORTSUITE_ID + "</td>" + "<td>" + "<a href=# id = name onClick = showTables(reportSuiteList.suites[i].name>" + reportSuiteList.suites[i].REPORTSUITE_NAME + "</a>" + "</td>" + "<td>" + reportSuiteList.suites[i].STAGING_DATABASE + "</td>" + "<td>" + reportSuiteList.suites[i].DWH_DATABASE + "</td>" + "</tr>";
}

output+="</table>";
document.getElementById("placeholder").innerHTML=output;

});

</body>
</html>

sto ricevendo l'errore come mancante) dopo l'argomento list.i l'ho controllato ma il mio (, {sembra bilanciato e non riesco a capire dove mi manca il). Per favore aiuto

risposte:

1 per risposta № 1

jQuery non è necessario, e window.location.replace(...) simulerà al meglio un reindirizzamento HTTP.

È meglio che usare window.location.href =, perché replace() non inserisce la pagina di origine nella sessionestoria, il che significa che l'utente non si blocca in un fiasco back-tasto senza fine. Se vuoi simulare qualcuno facendo clic su un link, usa location.href. Se vuoi simulare un reindirizzamento HTTP, usa location.replace.

Per esempio:

// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";