in Education by
I want to show in an alert a french sentence containing accentuated letters such as "é" and "à". So I use the utf-8 charset in the meta tag of my php file so that the letters "é" and "à" are displayed normally in a javascript alert. The problem is that when getting the ajax responseText then I get among the responses the code of the meta tag. So how to get only the echo result of the php file ? Here is the php file used by the ajax : <?php define("ROOT_PATH", "../../"); include ROOT_PATH . 'config.ajax.php'; include ROOT_PATH . 'config.inc.php'; require_once RP_MODELS.'produit.class.php'; $prod_code = $_GET['prod_code']; $db =& new DbConn() ; $produit =& new produit($db->getInstance()) ; $tab = $produit->lire($prod_code) ; if ( $tab['cnt'] > 0) $rep = "Le code produit " . $prod_code . " existe déjà !" ; else $rep = "0" ; echo $rep; ?> So I want only the $rep variable to be returned by the ajax responseText. How to achieve that ? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
<?php header('Content-Type: text/html; charset=utf-8'); define("ROOT_PATH", "../../"); include ROOT_PATH . 'config.ajax.php'; include ROOT_PATH . 'config.inc.php'; require_once RP_MODELS.'produit.class.php'; $prod_code = $_GET['prod_code']; $db =& new DbConn() ; $produit =& new produit($db->getInstance()) ; $tab = $produit->lire($prod_code) ; if ( $tab['cnt'] > 0) $rep = "Le code produit " . $prod_code . " existe déjà !" ; else $rep = "0" ; echo $rep; ?> Read: http://php.net/manual/en/function.header.php

Related questions

0 votes
    I want to show in an alert a french sentence containing accentuated letters such as "é" and "à". ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    I want to show in an alert a french sentence containing accentuated letters such as "é" and "à". ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    I want to show in an alert a french sentence containing accentuated letters such as "é" and "à". ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    I need to take the users input from the select box for Allergen1 once an option is selected and the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    I try to print images with a for loop but the images dont load. The images are in the same ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    I try to print images with a for loop but the images dont load. The images are in the same ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 10, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: How can I access an array/object? (6 answers) Closed 3 years ago. i have a ... print_r($_POST); i can see all the variable in the right way...
asked May 22, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: How can I access an array/object? (6 answers) Closed 3 years ago. i have a ... print_r($_POST); i can see all the variable in the right way...
asked May 17, 2022 in Education by JackTerrance
0 votes
    NOTE: I am not set on using VI, it is just the first thing that came to mind that might be able to do what I need ... there an automated way I can take the text: and change it to:...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    NOTE: I am not set on using VI, it is just the first thing that came to mind that might be able to do what I need ... there an automated way I can take the text: and change it to:...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    NOTE: I am not set on using VI, it is just the first thing that came to mind that might be able to do what I need ... there an automated way I can take the text: and change it to:...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    NOTE: I am not set on using VI, it is just the first thing that came to mind that might be able to do what I need ... there an automated way I can take the text: and change it to:...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    Is Meta keywords tag important for SEO?...
asked Mar 5, 2021 in Technology by Editorial Staff
0 votes
    Is it possible to get access to dismiss() in an SKScene class? Dismiss is a method available from ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    I have a UITableView with UITextFields as cells. I would like to dismiss the keyboard when the background ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 27, 2022 in Education by JackTerrance
...