Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @{
- Layout = null;
- }
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width" />
- <title>Index</title>
- <script src="~/Scripts/jquery-1.10.2.min.js"></script>
- <script type="text/javascript">
- function f1() {
- var token="";
- $.ajax({
- data: { webservice_username: 'hagha_saeed@yahoo.com', password: '09177173048' },
- url: 'http://www.travelinsure.ir/api/v1.1/authenticate',
- type: 'POST',
- dataType: 'json',
- success: function (data) {
- $.each(data, function (idx, result) {
- alert(result)
- token = result;
- f2(result);
- })
- },
- error: function (x, y, z) {
- alert(x.responseText);
- alert(z);
- }
- });
- }
- function f2(token) {
- alert('New: '+token);
- $.ajax({
- data: { token: token },
- url: 'http://www.travelinsure.ir/api/v1.1/getcitylist?token=',
- type: 'GET',
- dataType: 'json',
- success: function (data) {
- results = JSON.stringify(data);
- alert(results);
- a= JSON.parse(data);
- $.each(a, function (idx, result) {
- $("#sel").append("<option value='" + result.city_id + "'>'"+city_name+"'</option>");
- //alert(result.city_name);
- })
- },
- error: function (x, y, z) {
- alert(x.responseText);
- alert(z);
- }
- });
- }
- </script>
- </head>
- <body>
- <div>
- <input type="submit" name="name" value="Click!!!" onclick="f1()" />
- </div>
- <div id="mydiv">
- <select id="sel">
- <option>لیست شهرهای ایران</option>
- </select>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement