Javascript passing a variable to PHP

ngplayground

What I'm trying to do is use the below javascript to pull a php page into my html. This works, but what I need and struggling to do is use javascript to send a variable to php so I can use mysql to send results back.

httpRequest("garage-view-default.php", showdefaultimage);
function showdefaultimage(WIDGET){
    d = document.getElementById('garage-view-default');
    d.innerHTML = WIDGET;
}

function httpRequest(url, callback) {
    var httpObj = false;
    if (typeof XMLHttpRequest != 'undefined') {
        httpObj = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        try{
            httpObj = new ActiveXObject('Msxml2.XMLHTTP');
        } catch(e) {try{
            httpObj = new ActiveXObject('iMicrosoft.XMLHTTP');
        } catch(e) {}
    }
}
if (!httpObj) return;
httpObj.onreadystatechange = function() {
    if (httpObj.readyState == 4) { // when request is complete
        callback(httpObj.responseText);
    }
};
httpObj.open('GET', url, true);
httpObj.send(null);
}
randomizer

You can add a GET value to your url:

garage-view-default.php?key=value

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Passing php arrays variable to javascript for leaflet map

분류에서Dev

Passing php variable from one file to another?

분류에서Dev

Error Passing Variable to Include in PHP 5.3

분류에서Dev

Passing a string from .NET to a javascript variable

분류에서Dev

Passing a variable to a function through a button (HTML/Javascript)

분류에서Dev

PHP Variable in JavaScript Tag

분류에서Dev

Passing an argument to a Javascript function through PHP

분류에서Dev

Passing variable from one PHP page to another without refreshing

분류에서Dev

Passing variable to Javascript doesn't work in Rails 4.2

분류에서Dev

function variable not passing to global variable

분류에서Dev

Variable not passing through?

분류에서Dev

Passing a variable to a jquery selector

분류에서Dev

Issues passing a variable to a function

분류에서Dev

Passing variable to directive template

분류에서Dev

Passing variable parameters in Java

분류에서Dev

Can't use my php variable in JavaScript

분류에서Dev

Send variable to external PHP file from JavaScript

분류에서Dev

Javascript cant get value from PHP variable?

분류에서Dev

load php variable with jquery and work with javascript

분류에서Dev

Passing java-script variable to same form action php file argument

분류에서Dev

passing jstl value to javascript

분류에서Dev

Passing an array and a variable to a function in Perl

분류에서Dev

IN and WHERE, passing in a variable as a string or an array

분류에서Dev

Passing dynamic variable into jquery statement

분류에서Dev

Passing string variable as Argument in Powershell

분류에서Dev

RSpec passing variable or (let variable) to it block

분류에서Dev

Using jQuery to assign a string echoed by PHP to a variable in Javascript

분류에서Dev

Pass a variable from a javascript function to another php file

분류에서Dev

How to add php content or variable inside javascript alert box?! javascript, php, alertbox

Related 관련 기사

  1. 1

    Passing php arrays variable to javascript for leaflet map

  2. 2

    Passing php variable from one file to another?

  3. 3

    Error Passing Variable to Include in PHP 5.3

  4. 4

    Passing a string from .NET to a javascript variable

  5. 5

    Passing a variable to a function through a button (HTML/Javascript)

  6. 6

    PHP Variable in JavaScript Tag

  7. 7

    Passing an argument to a Javascript function through PHP

  8. 8

    Passing variable from one PHP page to another without refreshing

  9. 9

    Passing variable to Javascript doesn't work in Rails 4.2

  10. 10

    function variable not passing to global variable

  11. 11

    Variable not passing through?

  12. 12

    Passing a variable to a jquery selector

  13. 13

    Issues passing a variable to a function

  14. 14

    Passing variable to directive template

  15. 15

    Passing variable parameters in Java

  16. 16

    Can't use my php variable in JavaScript

  17. 17

    Send variable to external PHP file from JavaScript

  18. 18

    Javascript cant get value from PHP variable?

  19. 19

    load php variable with jquery and work with javascript

  20. 20

    Passing java-script variable to same form action php file argument

  21. 21

    passing jstl value to javascript

  22. 22

    Passing an array and a variable to a function in Perl

  23. 23

    IN and WHERE, passing in a variable as a string or an array

  24. 24

    Passing dynamic variable into jquery statement

  25. 25

    Passing string variable as Argument in Powershell

  26. 26

    RSpec passing variable or (let variable) to it block

  27. 27

    Using jQuery to assign a string echoed by PHP to a variable in Javascript

  28. 28

    Pass a variable from a javascript function to another php file

  29. 29

    How to add php content or variable inside javascript alert box?! javascript, php, alertbox

뜨겁다태그

보관