Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / подружить datatables и dialog jquery / 2 сообщений из 2, страница 1 из 1
30.10.2015, 01:52
    #39090668
ichthyologist
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
подружить datatables и dialog jquery
Здравствуйте, нужна помощь подружить datatables и dialog jquery. Необходимо при клике на строку в таблице отослать <tr> id скрипту php и открыть dialog с результатом. То, что сейчас есть.
Код: html
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" media="all" href="jquery-ui/jquery-ui.css">
<link rel="stylesheet" type="text/css" media="all" href="datatables/datatables.css">
<script type="text/javascript" src="jquery/jquery-2.1.4.js"></script>
<script type="text/javascript" src="jquery-ui/jquery-ui.js"></script>
<script type="text/javascript" src="datatables/datatables.js"></script>
</head>
<body>
<br>
<table id="outline" class="display">
	<thead>
		<tr>
			<th>Код</th>
			<th>Род</th>
			<th>Вид</th>
			<th>Русское название</th>
			<th>Английское название</th>
		</tr>
	</thead>
	<tbody>
		<tr id="1">
			<td>cod1</td>
			<td>fish1</td>
			<td>fish2</td>
			<td>runame</td>
			<td>enname</td>
		</tr>
		<tr id="2">
			<td>cod1</td>
			<td>fish1</td>
			<td>fish2</td>
			<td>runame</td>
			<td>enname</td>
		</tr>
	</tbody>
</table>

<div id="dialog"></div>

<script type="text/javascript">
$(document).ready(function(){
	/* Init DataTables */
	$('#outline').DataTable();
});
</script>

<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
	/* get <tr> id and add events */
	$("#outline tbody").on('click', 'tr', function(){
		var id=$(this).attr("id");
		alert("Click on <tr> id: "+id);
		
		/* До сюдова работает а дальше нет
		$("#dialog").dialog({
			autoOpen: false,
			show: { effect: "blind", duration: 300},
			hide: { effect: "blind", duration: 300}
			});
		$.ajax({
			type: 'GET', 
			url: 'get_taxa.php?term='+id, 
			success:function(result) {
					$("#dialog").html(result);}
			});
		$("#dialog").dialog("open"); */
	});
});
</script>
</body>
</html>

...
Рейтинг: 0 / 0
02.11.2015, 08:15
    #39092358
ichthyologist
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
подружить datatables и dialog jquery
Отвечу сам себе. Код работает на fiddle.js и работает с CDN. Видимо коряво скачались js'ы.
...
Рейтинг: 0 / 0
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / подружить datatables и dialog jquery / 2 сообщений из 2, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]