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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:25:59+00:00 2026-06-16T14:25:59+00:00

I have this AJAX function getValFromDb() { var university = document.getElementById(‘category’).value; var domain =

  • 0

I have this AJAX

   function  getValFromDb() {
   var university = document.getElementById('category').value;
   var domain = document.getElementById('subcategory').value;
   var year = document.getElementById('an').value;
   var url = "modules/mod_data/tmpl/script.php";

  var params = 'uni='+university+'&fac='+domain+'&an='+year;
    if (window.XMLHttpRequest) { AJAX=new XMLHttpRequest(); } else { AJAX=new ActiveXObject("Microsoft.XMLHTTP"); }
    if (AJAX)
    {
        AJAX.open("POST", url, false);
        AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        AJAX.onreadystatechange = function()
        {
            if(AJAX.readyState == 4 && AJAX.status == 200)
            {
             document.getElementById('materie').innerHTML = AJAX.responseText;
            }
        }; 

    } AJAX.send(params);
    }

an send params here

<?php
defined('_JEXEC') or die;
$db = JFactory::getDbo();

$an=$_POST('an');
$fac=$_POST('fac');
$uni=$_POST('uni');
  $result1 =mysql_query("SELECT DISTINCT (materie) FROM drv_uni_$uni WHERE an='$an'");
while($row = mysql_fetch_array($result1)){
    $display_string .= "<option value=\"".$row['id']."\">". $row['materie'] ."</option>";
} 

  echo $display_string;
?>

POST from firebug

      Parametersapplication/x-www-form-urlencoded
      an    an-3
      fac   Finante Banci
      uni   ase
      Source
      uni=ase&fac=Finante Banci&an=an-3

And HEADERS

     Response Headers

        Connection  keep-alive
      Content-Encoding  gzip
       Content-Type text/html
       Date Sun, 30 Dec 2012 13:12:47 GMT
      Server    xServers
      Transfer-Encoding chunked
       X-Powered-By PHP/5.3.16

Request Headers

       Accept   text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
      Accept-Encoding   gzip, deflate
      Accept-Language   en-US,en;q=0.5
        Connection  keep-alive
     Content-Length 33
        Content-Type    application/x-www-form-urlencoded; charset=UTF-8
       Cookie   0dea1a59adf779fae552e16f3d646b24=91481693c6b3c8615aa9ce57461aa590; 33a66e84ea7ae1332853383606d933e1=2039ee6737b4252207431790f5f7a939
              DNT   1
        Host    www.domain.ro
       Referer  http://www.domain.ro/upload
       User-Agent   Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0

THE RESPONSE IS EMPTY!

the Js doesn.t receive anything from php. The PHP have take the values corectly but when it send it doesnt get back to js. If you wanna show me how to use JSON or to corect this code i apreciate.

  • 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-16T14:26:00+00:00Added an answer on June 16, 2026 at 2:26 pm

    Try changing defined('_JEXEC') or die; to define('_JEXEC', 1) or die;. Note I have used define instead of defined. This has been an issue for a lot of people integrating Ajax in their extension as defined('_JEXEC') or die; usually blocks it for security reasons.

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

Sidebar

Related Questions

Hi I have this script: function ajax(){ if (navigator.standalone) return; for (var i= document.links.length;
I have this ajax jquery code: var form = document.getElementById('frm'); var data_string = form.serialize();
I have this jQuery code: $(document).ready(function() { $.ajax({ url: pages/+page+.php, cache: false }).done(function( html
I have this code, $('.editLayout #changeLayout').click(function() { $('html').height($(document).height()); $('#fluidWrap').hide('scale'); $.ajax({ data: { mainLayout: true
I have this ajax call to a doop.php . function doop(){ var old =
I have this ajax function: function callpage() { $('#formcontent').empty().html('<p class=vent>Pleace wait</p>'); var form =
I have this ajax event function save_response_with_ajax(t){ var form = $('#edit_'+t); var div =
I have a jQuery AJAX function like this: $.ajax({ url: 'crud/clients.php', dataType: 'json', type:
I am using the jQuery $.ajax() function. I have put this into a parent
I have this very simple jQuery function: $(.milestone-in-tree).live({ mouseenter: function() { setTimeout( $.ajax({ type:

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.