2017-01-27, 03:21 PM
Hi.
As the title, I want to ask that
"Is this possible to create some Ajax functions for MyBB like Ajax Login, Ajax Pagination ?"
1. MyBB Ajax Login
Please check above code, did I miss anything?
2. MyBB Ajax Pagination
Any suggestion for this?
i have find workng tut in mybb
here is live demo.
nulledbb.com
i have find this tut.
but i have not good knowledge in php and i cant make it fully.
post code in forum display below {$headinclude}
goo to tamplate edit and add code in multipage_page
data-page="{$i}"
like
forumdisplayajax.php
i cant make it if anyone can make this forumdisplayajax.php so it will working perfectly.
https://nulledbb.com/forumdisplayajax.php?fid=15
can anyone help to complete this awesome funtion
As the title, I want to ask that
"Is this possible to create some Ajax functions for MyBB like Ajax Login, Ajax Pagination ?"
1. MyBB Ajax Login
var username = $("input#username").val();
var password = $("input#password").val();
function make_base_auth(user, password) {
var tok = user + ':' + password;
var hash = btoa(tok);
return "Basic " + hash;
}
$.ajax
({
type: "POST",
url: "member.php",
dataType: 'json',
async: false,
data: '{}',
beforeSend: function (xhr){
xhr.setRequestHeader('Authorization', make_base_auth(username, password));
},
success: function (){
alert('Logged In!');
}
});
Please check above code, did I miss anything?
2. MyBB Ajax Pagination
Any suggestion for this?
i have find workng tut in mybb
here is live demo.
nulledbb.com
i have find this tut.
but i have not good knowledge in php and i cant make it fully.
post code in forum display below {$headinclude}
<script type="text/javascript">
<!--
lang.no_new_posts = "Forum Contains No New Posts";
lang.click_mark_read = "Click to mark this forum as read";
lang.inline_edit_description = "(Click and hold to edit)";
lang.post_fetch_error = "There was an error fetching the posts.";
// -->
jQuery(function(){
var currentPage = 1, page, totalPages = Math.ceil( 656 / 20 );
jQuery(document).on( 'click', '.pages a', function(e){
page = jQuery( this ).attr( 'data-page' );
if( currentPage == page || page > totalPages )
return;
jQuery( '.overlay' ).fadeIn().css({ 'width': jQuery( '.forumdisplay-major .pagination-top + .wrapper' ).width(), 'height': jQuery( '.forumdisplay-major .pagination-top + .wrapper' ).height() });
jQuery( '.spinner' ).fadeIn();//.css({ 'margin-top': jQuery( '.forumdisplay-major .wrapper' ).width()/2 - 50 });
jQuery.get( 'https://nulledbb.com/forumdisplayajax.php?fid={fid}&page=' + page, function(data){
jQuery( '.forumdisplay-major' ).html(data );
currentPage = page;
jQuery('html,body').animate({scrollTop: 0}, 'fast');
});
e.preventDefault();
} );
});
</script>
<script src="
https://nulledbb.com/assets/nulled/js/remodal.js"></script>
<script src="https://cdn.nulledbb.com/jscripts/jeditable/jeditable.min.js"></script>
<script type="text/javascript" src="https://cdn.nulledbb.com/jscripts/inline_edit.js?ver=1804"></script>
goo to tamplate edit and add code in multipage_page
data-page="{$i}"
like
<a href="{$page_url}" class="pagination_page" data-page="{$i}"> {$i}</a>
now ponint is forumdisplayajax.php
i cant make it if anyone can make this forumdisplayajax.php so it will working perfectly.
https://nulledbb.com/forumdisplayajax.php?fid=15
can anyone help to complete this awesome funtion