Tagged Questions
24
votes
8answers
78k views
using jquery $.ajax to call a PHP function
This may be a simple answer, but I'm using jquery's $.ajax to call a PHP script. What i want to do is basically put that PHP script inside a function and call the PHP function from javascript.
...
24
votes
7answers
8k views
How to show Ajax requests in URL?
What I want is to have links which change a part of the page , and a dynamic URL for it, where I can specify variables such like #calendar=10_2010tabview=tab2
Check this for an exact example: CLICK ...
1
vote
5answers
1k views
Creating jQuery AJAX requests to a PHP function
So far when creating AJAX requests I have been posting to a separate PHP file. Is it possible to create a jQuery AJAX request that calls a PHP function rather than posts to a separate page?
If you ...
58
votes
11answers
85k views
Resize iframe height according to content height in it
I am opening my blog page in my website. The problem is I can give a width to an iframe but the height should be dynamic so that there is no scrollbar in the iframe, and it looks like a single page...
...
7
votes
5answers
23k views
Call php function from javascript
Is there a way I can run a php function through a js function?
something like this:
<script type="text/javascript">
function test(){
document.getElementById("php_code").innerHTML="<?php
...
13
votes
5answers
16k views
Best way to transfer an array between PHP and Javascript
So I have an array of records retreived from a database. The array is in the format;
$rows[0]['id']=1;
$rows[0]['title']='Abc';
$rows[0]['time_left']=200;
$rows[1]['id']=2;
$rows[1]['title']='XYZ';
...
29
votes
7answers
16k views
PHP: Does $_SERVER['HTTP_X_REQUESTED_WITH'] exist or not?
All over the Internet, included even here at StackOverlow, people state that a good way to check if a request is AJAX or not is to do the following:
if (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) ...
18
votes
3answers
20k views
Simple jQuery, PHP and JSONP example?
I am facing the same-origin policy problem, and by researching the subject, I found that the best way for my particular project would be to use JSONP to do cross-origin requests.
I've been reading ...
26
votes
6answers
30k views
Passing JavaScript Array To PHP Through JQuery $.ajax
I want to manipulate a javascript array in PHP. Is it possible to do something like this?
$.ajax({
type: "POST",
url: "tourFinderFunctions.php",
data: ...
5
votes
8answers
5k views
Prevent Direct Access To File Called By ajax Function
I'm calling the php code from ajax like this:
ajaxRequest.open("GET", "func.php" + queryString, true);
Since it's a get request anyone can see it by simply examining the headers. The data being ...
13
votes
3answers
20k views
jquery submit form and then show results in an existing div
I have a simple one text input form that when submitted, needs to fetch a php file (passing the inputs to the file) and then take the result (just a line of text) and place it in a div and fade that ...
6
votes
2answers
6k views
Sending images from Canvas elements using Ajax and PHP $_FILES
I need to be able to send an image and some form fields from a client side canvas element to a PHP script, ending up in $_POST and $_FILES. When I send it like this:
<script ...
7
votes
4answers
5k views
How to avoid echoing character 65279 in php? (This question also relates to Javascript xmlhttp.responseText (ajax))
I have encountered a similar problem described here (and in other places) -
where as on an ajax callback I get a xmlhttp.responseText that seems ok (when I alert it - it shows the right text) - but ...
1
vote
2answers
608 views
How can I pass variables from JavaScript to PHP?
I am using jQuery to calculate prices. Here is a small snippet of my JavaScript:
// Prices: radio
var curLam = "gloss";
$("input[name=lamination]").click(function(){
var gloss = 5;
var matt = 6;
...
21
votes
10answers
28k views
Gmail like file upload with jQuery
I would like to upload files just like google mail does. I would want to use jQuery and PHP to do it is there anyway of getting the progressbar etc.?
Here I added a video of how google does it. ...