The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript refer PHP variable to JS

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #176741


    I have a dynamic reload script for postings and I would like to know, how I could refer a $_GET Variable to the reload script… the structure is:

    –> here is a certain div, where the content is loaded to via

    // Innerhalb der Liste href auslesen und durch # ersetzen, title-Attribut mit dem Wert des href schreiben
    $("div.list-wrap a").each(function(){
        var url = $(this).attr("href");
    // per Click entsprechende URL in das DIV laden, aber nur das DIV #seiteninhalt
    $("div.list-wrap a").click(function(){
        var quelle = $(this).attr("title");


    so far this is not problem and works fine.

    the file that has been loaded to the div is:
    <link rel=”stylesheet” type=”text/css” href=”style/dynrel.css”>
    <script src=”javascript/dynrel.js” type=”text/javascript”></script>

    <div class=”loader”></div>
    <div class=”container”></div>
    <div name=”loadlink” class=”loadlink imground” onclick=”loadcontent();”>
    <a href=”javascript:void(0);” onclick=”loadcontent();” class=”loadlinklink”>Beiträge laden</a>
    <div class=”end”></div>

        &lt;a name="load"&gt;&lt;/a&gt;

    where the postings should be loaded, depending on the category which is defined as ?category=whatever.

    so far the ?category – variable is accessible , but now when the javascript to reload the posts starts, it seems that this variable is not referred.

    the javscript:
    $(document).ready(function() {
    start = 0;
    count = 2;
    for (var i = 0; i < 1; i++){

    function loadcontent() {

        type: 'get',
        url: 'getarticle.php',
        async: false,
        data: { start : start, count : count},
        success: function (html){
                start = start + 2;
                $('.end').html('&lt;p&gt;Keine weiteren Posts&lt;/p&gt;');


    the problem seems to be that the final php – Page (getarticle.php) does not get the variable $_GET[‘category’].

    I’m sorry I know this question seems a little bit roundabout but I hope that the bottom line is kind of clear:

    How can I refer a $_GET variable from a php script to another php script that is dynamically loaded via js? I think thats the core question.

    Thank you very much for your time and help,


Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.