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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:51:12+00:00 2026-06-06T22:51:12+00:00

i have an problem with handling data come from server , please see the

  • 0

i have an problem with handling data come from server , please see the code bellow :

php

echo json_encode(array("toshow"=>"<span class='text'><img src='greencheck.png'/>"));

javascript

$('#data').ajaxForm({
                dataType: 'json',
                success: function(data){
                    if(data.error == 1){
                        $('#preview').html("<span class='text'><img src='close.png'/>"+data.filename+" File exsist ..</span>");
                    }else{

                         $('.first').after(data.toshow);
                    }
                }
                }).submit();

problem is when i send data from the server as {‘data’=>someData} , i have no problem .. when i send any html tags such as {'data'=>"<span>some data</span>"} success function in javascript is not processing anything so success = fails ..

case 1 : sending json data from the server example , {‘error’=>1,’msg’=>file exists} , in this case every thing is ok .
enter image description here

case 2 : sending json data from the server example ,{‘toshow’=>linkdatta…etc} , so in case of adding any html tag in json problem start so success function not working at all

enter image description here

  • 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-06-06T22:51:14+00:00Added an answer on June 6, 2026 at 10:51 pm

    In your php file set content-type to json:

    header('Content-type: application/json');
    echo json_encode(.........);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Regular Expression problem I have Regular Expression code handling graphic files. $view[content] = preg_replace(/(\<img
i have one problem with handling list,i have three class named as UserInf,userData,userProcess,i created
I have a problem with slashes! I have some jQuery for handling generic dialogs
I experience strange problem. We have error handling in global.asax that would redirect user
I have problem with UIWebView delay when the load image from url. In my
I have problem while loading data into html select when users press or click
I have a problem handling messages in a Thread. My run-method looks like this
We have a local server with an access database which feeds data to clients
I have a problem with handling json variables in javascript. The problem appears when
I really need your help since I have a frustrating problem. I'm downloading data

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.