Jump to content

php and javascript


Guest

Recommended Posts

quick question can i use an external js to run a php file and the php file will print out correct javascript. If i can how would i if i cant is there ny other way that i can use javascript and get variables from mysql and update mysql. Thank You
Link to comment
Share on other sites

i want to make it so a basic website can get variables out of my database. I want to use an external javascript to display results so i was wondering if i could make the external javascript out of php to get the data. I want to use php to make the .js with the correct information
Link to comment
Share on other sites

The site that this is on doesnt support php and it needs to display and change a couple little things from the database. This is the only way i can think of doing that.
Link to comment
Share on other sites

Yeah you can get JavaScript to run a php file, not sure how on a seperate server.  I'm not too hot with JS but here's a snippet I fished out of an external .js file I use to get results from a database and use them in a drop down menu.
[code]
<?php

var ajax_list_externalFile = "../lib/php/ajax-list-companies.php";

        ajax_optionDiv.innerHTML = '';
var ajaxIndex = ajax_list_objects.length;
ajax_list_objects[ajaxIndex] = new sack();
var url = ajax_list_externalFile + '?' + paramToExternalFile + '=1&letters=' + inputObj.value.replace(" ","+");
ajax_list_objects[ajaxIndex].requestFile = url; // Specifying which file to get
ajax_list_objects[ajaxIndex].onCompletion = function(){ ajax_option_list_showContent(ajaxIndex,inputObj,paramToExternalFile); }; // Specify function that will be executed after file has been found
ajax_list_objects[ajaxIndex].runAJAX(); // Execute AJAX function
?>
[/code]

Don't know If you can make more sense of that but I hope it helps ;)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.