i need to use jquery for something.. but i need to get a php file containing the data so that jquery (js) will output the content of this file.
if you get that..
thanks
ash
get file
Re: get file
you cant ge the contents of a file on the server directly, you will have to do an ajax request for the file...
Re: get file
so how would i do this?
i found this..
[syntax=javascript]$.ajax({
url: "xxx/xxx.php",
type: "GET",
data: data,
cache: false,
success: function (html) {
alert("HTLM = " + html);
$('#product-list').html(html);
}
});[/syntax]
would i put it in a function or just js tags?
i found this..
[syntax=javascript]$.ajax({
url: "xxx/xxx.php",
type: "GET",
data: data,
cache: false,
success: function (html) {
alert("HTLM = " + html);
$('#product-list').html(html);
}
});[/syntax]
would i put it in a function or just js tags?
I would put a signature.. BUT, i don't have the time.
Re: get file
Looks like jQuery to me... so I can't really help with that
If it is correct, it can work in both of those situations
ashwood wrote:would i put it in a function or just js tags?
If it is correct, it can work in both of those situations
Re: get file
this is what ive got
index.php
[syntax=xhtml]<html>
<head>
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type='text/javascript' langauge='javascript'>
$.ajax({
url: "source.php",
type: "GET",
data: data,
cache: false,
success: function (html) {
alert("HTLM = " + html);
$('#jquery-div').html(html);
}
});
</script>
</head>
<body>
<div id='jquery-div'></div>
</body>
</html>[/syntax]
source.php
[syntax=php]<?php
echo "Work work work work work ";
?>[/syntax]
but nothing
index.php
[syntax=xhtml]<html>
<head>
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type='text/javascript' langauge='javascript'>
$.ajax({
url: "source.php",
type: "GET",
data: data,
cache: false,
success: function (html) {
alert("HTLM = " + html);
$('#jquery-div').html(html);
}
});
</script>
</head>
<body>
<div id='jquery-div'></div>
</body>
</html>[/syntax]
source.php
[syntax=php]<?php
echo "Work work work work work ";
?>[/syntax]
but nothing
I would put a signature.. BUT, i don't have the time.