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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:27:38+00:00 2026-06-04T18:27:38+00:00

I have this in my config.php file $DOMAIN = ‘http://domain.com’; $DOMAIN_SSL = ‘http://domain.com’; $DOMAIN_ROOT

  • 0

I have this in my config.php file

     $DOMAIN = 'http://domain.com';
 $DOMAIN_SSL = 'http://domain.com';
$DOMAIN_ROOT = 'var/domain/root/html';

config.php is included in each page on first line

Now I have this jQuery code

var country = '<?php echo $_GET['country'];?>'; 
var category = 'Cat' ;
var category = '<?php echo $DOMAIN.'/link'; ?>';

How can I get variables from php with jQuery code to make jQuery code like this

var country = '$country'; 
var category = 'Cat' ;
var url= '$domain','/link';

ORIGINAL CODE
I NEED TO EXLUDE PHP

var country = '<?php echo $_GET['country'];?>'; 
                var category = 'CAT1' ;               
                function loadData(page){
                    loading_show();                    
                    $.ajax
                    ({
                        type: "POST",
                        url: "<?php echo $DOMAIN ?>/post.php",
                        data: "page="+page +"&category="+category+"&country="+country,
                        success: function(msg)
                        {
                        loading_hide();
                        $("#content-large").html(msg);
                        }
                    });
                }
                loadData(1);  // For first time page load default results
                $('#content-large .pagination li.active').live('click',function(){
                    var page = $(this).attr('p');
                    loadData(page);

                });           
                $('#go_btn').live('click',function(){
                    var page = parseInt($('.goto').val());
                    var no_of_pages = parseInt($('.total').attr('a'));
                    if(page != 0 && page <= no_of_pages){
                        loadData(page);
                    }else{
                        alert('Enter a PAGE between 1 and '+no_of_pages);
                        $('.goto').val("").focus();
                        return false;
                    }

                });
            });
  • 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-04T18:27:41+00:00Added an answer on June 4, 2026 at 6:27 pm

    Updated Answer

    If you’re attempting to get values from the URL, much like you would using $_GET in PHP, I would encourage you to use something like the jQuery URL Parser:

    var country = $.url().param("country"); // Gets the 'country' parameter
    

    Download jQuery URL Parser: https://github.com/allmarkedup/jQuery-URL-Parser

    Original Answer

    I would encourage you to keep it simple; just use formatted strings and json_encode. For example:

    $country  = "United States";
    $domain   = "http://stackoverflow.com";
    $category = 5;
    
    printf( "var country  = %s;", json_encode( $country ) );
    printf( "var category = %s;", json_encode( $category ) );
    printf( "var domain   = %s;", json_encode( $domain . "/link" ) );
    

    Which outputs:

    var country  = "United States";
    var category = 5;
    var domain   = "http:\/\/stackoverflow.com\/link";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this setting. root dir| index.php config.php file.php | | |scripts|a.js | |account
I have a php file that looks like this: <?php include(config.php); // put the
Hello guys I have this code in main.php config file: 'components' => array( '[.........]',
I have a rather confusing problem. I have a php file (http://example.com/delete.php) <?php session_start();
I have a rather confusing problem. I have a php file (http://example.com/delete.php) <?php session_start();
I have this nginx vhost file server { # php/fastcgi listen 80; server_name trinityplex.com
I have the following in my config/routes.php file: $route['(:any)'] = dashboard/index/$1; This works as
As many do I have a config.php file in the root of a web
I have a file system structure with symlinks, something like this: folder123 index.php config.php
Hallo I have this script: <? require(lib2/config.inc.php); require(lib2/tpl.class.php); require(lib2/db.class.php); require(lib2/um.class.php); $tpl = new template(templates,

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.