Guest Posted November 24, 2006 Share Posted November 24, 2006 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 Quote Link to comment Share on other sites More sharing options...
Stooney Posted November 24, 2006 Share Posted November 24, 2006 can you restate the question by chance? doesn't make sense to me :( Quote Link to comment Share on other sites More sharing options...
DeathStar Posted November 24, 2006 Share Posted November 24, 2006 [b]What do you mean like run a .js in php or what?[/b] Quote Link to comment Share on other sites More sharing options...
Guest Posted November 24, 2006 Share Posted November 24, 2006 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 Quote Link to comment Share on other sites More sharing options...
Fallen_angel Posted November 24, 2006 Share Posted November 24, 2006 sorry to hijack but I am looking for a way to do the oposite if anyone knows that aswell I need to figure out how to pass a javascript variable to a NEW php page , so that I can echo the javascript variable results to a php variable and then insert it into a database Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted November 24, 2006 Share Posted November 24, 2006 what i am wondering is why you want to print the data from javascript. why not just do it in php? Quote Link to comment Share on other sites More sharing options...
Guest Posted November 24, 2006 Share Posted November 24, 2006 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. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted November 24, 2006 Share Posted November 24, 2006 i dont think it would be possible. your talking about running a php script as a part of a javascript file. if the server dosnt support php then i dont think you would be able to do it. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 24, 2006 Share Posted November 24, 2006 I would want it to run on a remote server that allows it. Quote Link to comment Share on other sites More sharing options...
scottybwoy Posted November 24, 2006 Share Posted November 24, 2006 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 ;) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.