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

  • Home
  • SEARCH
  • 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

Is it possible that using jQuery, I cancel/abort an Ajax request that I have
Several of my ajax applications in the past have used GET request but now
I am using asp.net MVC to develop an application that will have ajax interactions.
I have an Ajax.Net enabled ASP.Net 2.0 web site. Hosting for both the site
I have some AJAX work that brings across an additional form element that I
When a user clicks a link, I would like to send an AJAX request
I have written a web app in PHP which makes use of Ajax requests
I have an application in which most requests are submitted via AJAX, though some
With ASP.NET MVC, it is common to have AJAX code(e.g. jQuery) to invoke web
I have $.ajax({ url: identity, success: function(data) { ProcessIdentityServer(data) } }); When 'data' is

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.