Ajax Functions for MyBB?
Destro Offline
Junior Member
**
Posts: 39
Joined: Nov 2012
Post: #1
Ajax Functions for MyBB?
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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?

(This post was last modified: 05-12-2013 07:14 PM by Destro.)
05-12-2013 07:14 PM
Find all posts by this user Quote this message in a reply
Jonatthu Offline
Junior Member
**
Posts: 34
Joined: Mar 2013
Post: #2
RE: Ajax Functions for MyBB?
Yeah Ajax Pagination is something that I want Ouch but I dont have any idea to do that
05-13-2013 04:12 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #3
RE: Ajax Functions for MyBB?
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.

My Blog
05-13-2013 11:49 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #4
RE: Ajax Functions for MyBB?
Ajax pagination on forumdisplay and showthread would be very cool indeed.


[Image: leelink.gif]
MYBB1.6 & XThreads
05-13-2013 09:42 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Destro Offline
Junior Member
**
Posts: 39
Joined: Nov 2012
Post: #5
RE: Ajax Functions for MyBB?
(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 ? Ouch

Anyway, where I can find the current mybb pagination functions? (the file wrap it)
(This post was last modified: 05-14-2013 03:08 AM by Destro.)
05-14-2013 03:02 AM
Find all posts by this user Quote this message in a reply
prince Offline
Junior Member
**
Posts: 2
Joined: Jan 2017
Post: #6
RE: Ajax Functions for MyBB?
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<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

01-28-2017 01:11 AM
Find all posts by this user Quote this message in a reply
Alson Offline
Junior Member
**
Posts: 2
Joined: Sep 2017
Post: #7
RE: Ajax Functions for MyBB?
#bump it, I also need this.
09-12-2017 09:12 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: