당신이 jQuery로 웹 페이지를 가지고 가정.
HTML
<a class="access-only" href="http://192.168.1.2?light=1">Turn on the light</a>
<a class="access-only" href="http://192.168.1.2?light=0">Turn off the light</a>
JS
$(document).ready(function() {
// Attach click handler to all "access-only" links.
$('a.access-only').click(function() {
// Once the link is clicked, access its URL with a GET request.
$.get($(this).attr('href'), function(response) {
// Do nothing here, the URL has been accessed.
});
// Return false to prevent the browser's default click action.
return false;
});
});
'컬'했습니까? –
아니요, 저는 ... –
'컬 (curl)'은 과도한 상황입니다. 정말로 필요한 것은 AJAX 호출이며 링크의 클릭 이벤트에 첨부됩니다. – Anton