jQuery - Ajax with PHP

AbdullaScript • منذ 9 سنوات

Alsalam alikum

 

I'm having a problem with ajax php, it works fine but mybox div disappear after executing ajax, so i have to use location.reload() which it will reload the page if .load() function completed, this is not I'm looking for,  i don't want to refresh the page

 

Here's the code - head


<script type="text/javascript">
 $(document).ready(function() {
     $('#ajaxload').click( function() {
        var href = $(this).attr('href');
        $('#mybox').load( href , function() {
            
             location.reload();
          
        });
        return false;
     });
 });
</script>


HTML - PHP

<div id='mybox'>
<a class='waves-effect waves-light btn modal-trigger grey' href='#modal1' style='width:auto;'><i class='material-icons'>account_circle</i> Seller Info</a>
                              
<a href='folder/file.php?delete=$ID'  id='ajaxload' class='waves-effect waves-light btn red' style='width:auto;'><i class='material-icons'>favorite_border</i></a>
</div>


 

كلمات دليلية:

ساعد بالإجابة

"إن في قضاء حوائج الناس لذة لا يَعرفها إلا من جربها، فافعل الخير مهما استصغرته فإنك لا تدري أي حسنة تدخلك الجنة."

الإجابات (4)

AbdullaScript • منذ 9 سنوات

The thing is both of scripts are right cus they give the same result which it is ajax will be executed but i think that i have a logical error in retrieving data from DB.

Thanks for your help buddy, i'll come bk with another ajax php mysqli question about the optimal way to retrieve data from mysqli DB.

AbdullaScript • منذ 9 سنوات

i've soved a major problem in other page by modifying this code a lil, the page is being loaded 10x faster .. you are my hero bro .. THUMBS UP

btw, we need to spread this website among developers .. we have to work together

Ali Majrashi • منذ 9 سنوات

i've soved a major problem in other page by modifying this code a lil, the page is being loaded 10x faster .. you are my hero bro .. THUMBS UP

btw, we need to spread this website among developers .. we have to work together

after finishing your project and feel like sharing it with public you can post about it with full detail in إبداعاتك  and we will make sure to tweet about it and share it so it can be inspiration for other people 

AbdullaScript • منذ 9 سنوات

In fact i have 2 projects, one for me and my friend which it is a selling website just for Bahrain and the other thing is so much bigger it is a Point Of Sales web-app and i assume you know how big these types of web-apps are.

 

It's for a company, then i'll have to re-develop a demo version for public.

 

Once again, I'm glad to be here , thank you so much for this tremendous website ... and sure i'll post both of them in ebdaat.

لايوجد لديك حساب في عالم البرمجة؟

تحب تنضم لعالم البرمجة؟ وتنشئ عالمك الخاص، تنشر المقالات، الدورات، تشارك المبرمجين وتساعد الآخرين، اشترك الآن بخطوات يسيرة !