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 6622333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:23:32+00:00 2026-05-25T21:23:32+00:00

I have a problem to refresh a bloc in my page. Here is the

  • 0

I have a problem to refresh a bloc in my page.

Here is the request:

> $("#pwd_lost_link").click(function(){
    alert('1');
    $.ajax({
      type : 'POST',
      url: 'test.php',
      dataType: 'json',
      data :{"nom" : "akbar"},
      success : function(data){
        $("#main_bloc").append(data.msg);
        alert('2');
      },
      error : function(XMLHttpRequest, textStatus, errorThrown) {
                alert(XMLHttpRequest.responseText);
                                alert(errorThrown);             }
    });   })

and here is the php file

<?php  
 $return['nom'] = "ffrfrfrfr";
  echo json_encode($return)
?> 

It doesn’t work. It give me a status error ( 0 ) and the page is automatically reloaded

Thanks

Michaël

  • 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-25T21:23:33+00:00Added an answer on May 25, 2026 at 9:23 pm

    Confusing question Michael, not sure what you mean by “the page is automatically reloaded” but you should do 2 things:

    In the $.ajax() method, make sure your success called back is handling the data correctly. You are looking for data.msg but I don’t see where .msg comes from.

        $.ajax({
            type: "GET",
            contentType: "application/json; charset=utf-8",
            data: {},
            dataType: "json",
            url: url,
            success: function(data) {
                // parse data object so you can see what's being returned ex. alert(data) or alert(data[0]) or alert(data.nom)
            },
            error: function (xhr, status, error) {
                // XHR DOM reference: http://www.w3schools.com/dom/dom_http.asp
                // check for errors  ex. alert(xhr.statusText);              
            } 
        });
    

    On the PHP side, you may want to debug there to see what is being received and what you are sending back.

    Aside from that using an XHR viewer like Firebug or Chrome’s built-in utility (CTRL+SHIFT+I) can be very helpful.

    And on a final note, if pwd_lost_link is a link elment a id="pwd_lost_link" href="..." then you will have to stop the browser from following the link before you process the AJAX.

    $("#pwd_lost_link").click(function(e) {
        e.preventDefault(); 
        alert('1');
        $.ajax({      
       ...
    });
    

    If you aren’t seeing the ‘1’ being alerted then that is definitely your first problem.

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

Sidebar

Related Questions

I have a problem with this jQuery code: $(document).ready( function(){ alert($('#search').val()); var dummyInput =
The problem i have is i could DELETE but then when i hit refresh
I have problem with fancybox. I want to write a function that will run
i have a problem whenever i Refresh the prograss bar i get the error
I have encountered a problem when I refresh the observable collection behind my Silverlight
I have a problem in using Samrtm Mysql and Jquery or Ajax and if
Here I have the problem with uploading image in PHP. The problem is that
I have a problem with my form when I try to submit with ajax.
Zend Gurus: I have a problem that my session expires if I refresh a
I have a problem wtih session_start() on primary server. When I load page for

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.