-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsontest.html
211 lines (169 loc) · 5.72 KB
/
jsontest.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
</title>
<link rel="stylesheet" href="css/jquery.mobile-1.1.0.min.css" />
<link rel="stylesheet" href="css/style.css" />
<script src="js/jquery.min.js">
</script>
<script src="js/jjjjjjjjquery.mobile-1.1.0.min.js">
</script>
<script type="text/javascript">
$( '#page1' ).live( 'pageinit',function(event){
//alert( 'This page was just enhanced by jQuery Mobile!' );
});
function myFunction(data){
alert ("hola");
}
$(document).ready(function() {
function testImage() {
var jqxhr = $.ajax( "http://michancla.es/rest2/node.json" )
.done(function() { alert("success"); })
.fail(function() { alert("error"); })
.always(function() { alert("complete"); });
/*
// Assign handlers immediately after making the request,
// and remember the jqxhr object for this request
var jqxhr = $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?",
{
tags: "cat",
tagmode: "any",
format: "json"
}, function() {
alert("success");
})
.success(function() { alert("second success"); })
.error(function() { alert("error"); })
.complete(function() { alert("complete"); });
// perform other work here ...
// Set another completion function for the request above
jqxhr.complete(function(){ alert("second complete"); });
*/
/*
{
tags: "cat",
tagmode: "any",
format: "json"
}
var obj={
node:{
title: 'New node test',
type:'chancla', //Whatever your content type is..
//language:'en', //this attribute is optional, en for english
body: {
und: [
{value:'sdasdasd', format:'full_html'} //This is the body, if you have other fields its supposed to be similar, just body would be the field name
]
}
}
};
try {
$.ajax({
url: "http://michancla.es/rest/node.json",
type: 'GET',
dataType: 'jsonp',
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert('page_node_pages - fffailed to retrieve pages');
console.log(JSON.stringify(XMLHttpRequest));
console.log(JSON.stringify(textStatus));
console.log(JSON.stringify(errorThrown));
},
success: function (data) {
alert("siiii");
console.log(JSON.stringify(data));
}
});
}
catch (error) { alert("page_node_pages - " + error); }
*/
/* $.getJSON("http://michancla.es/rest/?tags=cat&tagmode=any&format=json&jsoncallback=?",
function(data){
alert (data);
console.debug(data);
$.each(data.items, function(i,item){
$("<img/>").attr("src", item.media.m).appendTo("#images");
if ( i == 3 ) return false;
});
});*/
}
$('.test').click(function () { testImage(); });
});
</script>
</head>
<body>
<div data-role="page" id="page1">
<div data-theme="a" data-role="header">
<h3>
Mi Chancla
</h3>
</div>
<div data-role="content">
<div>
<p>
<strong>
We love chanclas!
<br />
<br />
</strong>
</p>
</div>
<div>
<p>
Upload a photo of your chanclas, or a friends, or any chancla you see around.
<br />
</p>
</div>
<input type="button" class="send-image" value="camera" />
<input type="button" class="send-image" value="library" />
<hr />
<input type="button" class="test" value="test" />
<div id="images">
</div>
</div>
</div>
<div data-role="page" id="chancla_details">
<div data-theme="a" data-role="header">
<h3>
Review submition
</h3>
</div>
<div data-role="content">
<form action="#chancla_details" method="POST">
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<label for="description">
Description
</label>
<input id="description" placeholder="Description..." value="" type="text" />
</fieldset>
</div>
<div>
<img src="" id="image" alt="image" style="width: 100%;" />
</div>
<div data-role="fieldcontain">
<label for="category">
Category
</label>
<select name="category" id="category">
<option value="casual">
Casual
</option>
<option value="fun">
Fun
</option>
<option value="style">
Style
</option>
<option value="other">
Other
</option>
</select>
</div>
<input type="submit" data-theme="e" value="Send" />
</form>
</div>
</div>
</body>
</html>