Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- function fceUpload() {
- console.log("nahravam obrazek");
- document.form2.action = "/ppro/upload"
- uploadJqueryForm();
- }
- function fcePost() {
- document.form2.action= "/ppro/postSave"
- document.form2.submit();
- }
- function uploadJqueryForm() {
- $('#result').html('');
- $("#form2").ajaxForm({
- success: function(data) {
- var path = "get/" + data;
- var img=$("<img />").attr("src",path);
- img.appendTo($("#result"));
- document.getElementById("imageId").value=data;
- },
- dataType: "text"
- }).submit();
- }
- </script>
- <%-- Nacitani novych prispevku na zed AJAXem --%>
- <script>
- /*
- var divs = document.getElementsByClassName('post');
- console.log(divs.length, "divs with class *post*");
- for(var i=0; i<divs.length; i++) {
- var id = divs[i].getAttribute('data-id');
- console.log(id, "lastPostID");
- }
- */
- //var lastPostID;
- $(document).ready(function(){
- setInterval(function(i) {
- var divs = document.getElementsByClassName('post'); // pomoci jQuery to nefunguje :-(
- var lastPostID = parseInt( divs[0].getAttribute('data-id') );
- var myurl = "/ppro/postJS/from/"+parseInt(lastPostID);
- console.log(myurl, "myurl");
- $.ajax({
- url: myurl,
- cache: true,
- success: function(html){
- $("#post-new").html(html); // pomocny div
- // j('#post-new').contents().hide().prependTo("#allPosts").slideDown("slow"); // bez hide() neskryje stare prispevky - nejak to nefunguje :-(
- $("#post-new").prependTo("#allPosts"); // verze bez animace
- // j("#post-new").empty(); // vymaze obsah pomocneho divu (je to vubec potreba?)
- }
- })
- }, 10000)
- });
- </script>
- <section id="top" class="one">
Advertisement
Add Comment
Please, Sign In to add comment