Created
November 7, 2014 16:35
-
-
Save v0d1ch/6b5d11a9edd190834b0a to your computer and use it in GitHub Desktop.
djuka
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.1.js"></script> | |
<div id="fajshe"></div> | |
<script type="text/javascript"> | |
(function($){ | |
var Posts=[]; | |
$.fn.sigdeKadju= function(url){ | |
var Obj = this; | |
Obj.html("<img src='https://assets-production.ratecity.com.au/assets/elements/ajax-loader-6ec0bf541aea8d741acda04ca9283bb3.gif' />"); | |
var Iterator=function(v,k,Array){ | |
console.log(v); | |
Obj.append("<p>Title :<a href='v.url'>"+v.title+"</a></p>"); | |
Obj.append("<p>Url :<a href='v.url'>"+v.url+"</a></p>"); | |
Obj.append("<p>Date :<a href='v.url'>"+v.date+"</a></p>"); | |
Obj.append("<p>Author Name :"+v.author.first_name+"</p>"); | |
Obj.append("<p>Author slug :"+v.author.slug+"</p>"); | |
}; | |
$.ajax({ | |
type:"POST", | |
url:url, | |
success:function(data){ | |
//console.log(data.posts); | |
if(data.posts.length > 0){ | |
Obj.html(""); | |
var data = data.posts.forEach(Iterator); | |
return Obj; | |
} | |
//return Obj.html(data.posts); | |
}, | |
error:function(){ | |
} | |
}); | |
} | |
}(jQuery)); | |
$(document).ready(function(){ | |
$("#fajshe").sigdeKadju('http://www.cyprus.st.dooapp.net/api/get_recent_posts/'); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment