質問編集履歴

1

HTMLのソースコードを書き忘れていました。すみません

2016/06/10 06:29

投稿

tigaimasu
tigaimasu

スコア13

test CHANGED
File without changes
test CHANGED
@@ -1,8 +1,10 @@
1
+ ```php
2
+
1
3
  <?php
2
4
 
3
5
  /*Webスクレイピングの質問です.
4
6
 
5
- 下記のソースコードにURLを入力するとサイトからタグを拾ってくるというものを作りました。これをHTMLからキード検索でるようにしですHTMLドを教えください。
7
+ 下記のソースコードにURLを入力するとサイトからタグを拾ってくるというものを作りました。スコードを拾ってきたですが、HTMLにデタがとんできません。どこが間違っますか?
6
8
 
7
9
  */
8
10
 
@@ -19,3 +21,77 @@
19
21
 
20
22
 
21
23
  ?>
24
+
25
+
26
+
27
+ ```
28
+
29
+
30
+
31
+ ```HTML
32
+
33
+ <!DOCTYPE html>
34
+
35
+ <html>
36
+
37
+ <head>
38
+
39
+ <title></title>
40
+
41
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>
42
+
43
+ <script src="123.php"></script>
44
+
45
+ <script>
46
+
47
+ $(document).ready(function(){
48
+
49
+ $("#btn").click(function(){
50
+
51
+ $("#output").html("");
52
+
53
+ $.ajax({url:url, dataType:"json", cache:false, success:function(j){
54
+
55
+ $.each(j["list"], function(i){
56
+
57
+
58
+
59
+ if(this.title.indexOf($("#key").val()) != -1){
60
+
61
+ var src = (this.url) ? "<div>" + this.date + ":" + this.title + "<a href='" + this.url + "' target='_blank'>表示</a></div><hr>" : "<div>" + this.date + ":" + this.title + "</div><hr>";
62
+
63
+ $("#output").append(src);
64
+
65
+ }
66
+
67
+ });
68
+
69
+ }}).fail(function(res){
70
+
71
+ $("#output").html(res.responseText);
72
+
73
+ });
74
+
75
+ });
76
+
77
+ });
78
+
79
+ </script>
80
+
81
+ </head>
82
+
83
+ <body>
84
+
85
+ 検索キーワード<input type="text" id="key"><br>
86
+
87
+ <input type="button" value="検索" id="btn">
88
+
89
+ <div id="output"></div>
90
+
91
+ </body>
92
+
93
+ </html>
94
+
95
+
96
+
97
+ ```