Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4337816
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:59:46+00:00 2026-05-21T10:59:46+00:00

Ok. So I have a ajax request that I send to the server. This

  • 0

Ok. So I have a ajax request that I send to the server. This response contain the html that I am going to append to the site. My goal is to never reload the page, instead remove and add html with ajax requests in the background.

First I am not sure how I am going to generate the HTML with php. I want to create a table with previous successful logins. Something like this:

    $html = <<<HTML

    <div class="box">
        <h2>
            <a id="toggle-logins">Previous logins</a>
        </h2>
        <div class="block" id="logins">

        <table>
            <tr>
                <th>Country</th>
                <th>City</th>
                <th>IP address</th>
                <th class="currency">Time</th>
            </tr>   
            <tr>
                <td>Norway</td>
                <td>Oslo</td>
                <td>192.168.1.155</td>
                <td class="currency">2011-04-15 04:00</td>
            </tr>   
        </table>
        </div>
    </div>

HTML;

But how do I add a for loop for example into the mix so I can use arrays from the db to generate tables?

Next I send the json back.

$data = array( "message" => T_gettext("previous logins received"), "html" => $html );
return json_encode( $data );

Then I append it to the site with

var data = jQuery.parseJSON(data); 

    $("x")
    .append(data.html)

This works fine, but I would like to know how to password encrypt and compress the $data or $html variable with php and then use jquery to decompress and decrypt it if this is possible. The password encryption might not be necessary in this example, but I would like to password encrypt chat and other features in the future.

Something like:

$html = super_encryption($html, $password); 

then in jquery

data.html = super_decryption(data.html, password);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:59:47+00:00Added an answer on May 21, 2026 at 10:59 am

    just gzip the content. Browsers support this so no jQuery needed. Enable this by

    <?php
      ob_start("ob_gzhandler");
    ?> 
    

    As for password-protection. Just use SSL (https). There’s no real safe javascript based way of encrypting your data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I have this link, that should send an AJAX request everytime it is
I have ajax request that do 3 missions: Save Model (DB) Send Email Give
I have a AJAX request that will return a string that contains some HTML
I have several HTML elements (buttons) that fire the same JQuery AJAX request. When
Alright, so I have some jQuery code that will send an AJAX request to
I have an Ajax request that can return more than one valid value, so
I have a Ajax request that fires on clicking a href that is part
I have a jQuery AJAX post request that is unexpectedly triggering the error callback
In my application I have a drop-down form that fires up an AJAX request
I have a tooltip on an anchor element, that sends an AJAX request on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.