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
PHP Code:
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?
Yeah Ajax Pagination is something that I want

but I dont have any idea to do that
I wouldn't bother trying AJAX login.
Too many potential pitfalls for not really any benefit.
(05-12-2013 07:14 PM)Destro Wrote: [ -> ]Please check above code, did I miss anything?
Yes, heaps of stuff. For one, your page display doesn't change at all.
Pagination is simpler, if you only really care about forumdisplay/showthread. Otherwise, prepare for a fair bit of pain.
Ajax pagination on forumdisplay and showthread would be very cool indeed.
(05-13-2013 11:49 AM)ZiNgA BuRgA Wrote: [ -> ]I wouldn't bother trying AJAX login.
Too many potential pitfalls for not really any benefit.
(05-12-2013 07:14 PM)Destro Wrote: [ -> ]Please check above code, did I miss anything?
Yes, heaps of stuff. For one, your page display doesn't change at all.
Pagination is simpler, if you only really care about forumdisplay/showthread. Otherwise, prepare for a fair bit of pain.
Why ?
Anyway, where I can find the current mybb pagination functions? (the file wrap it)
here is live demo.
nulledbb.com
i have find this tut.
but i have not good knowledge about php and i cant make it fully.
post code in forum display below {$headinclude}
Code:
<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
Code:
<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
#bump it, I also need this.