Diferència entre revisions de la pàgina «MediaWiki:Common.js/infocarrer.js»
De Català a Cort
| Línia 1: | Línia 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
$(function () { | $(function () { | ||
| − | + | h = "Nom del carrer: <input type=\"text\" id=\"q\"></input><button id=\"cerca\">Cerca</button>"; | |
| + | h += "Resposta!"; | ||
| + | jQuery("#infocarrer").html(h); | ||
jQuery("#cerca").click(function() { cercaCarrer(jQuery("#q").val().trim()); }); | jQuery("#cerca").click(function() { cercaCarrer(jQuery("#q").val().trim()); }); | ||
}()); | }()); | ||
Revisió del 12:15, 11 abr 2017
/* Any JavaScript here will be loaded for all users on every page load. */
$(function () {
h = "Nom del carrer: <input type=\"text\" id=\"q\"></input><button id=\"cerca\">Cerca</button>";
h += "Resposta!";
jQuery("#infocarrer").html(h);
jQuery("#cerca").click(function() { cercaCarrer(jQuery("#q").val().trim()); });
}());
function cercaCarrer(que)
{
if (que == "")
return;
jQuery.getJSON("carrers/?q=" + que, function(resposta) {
console.log(resposta);
});
}