Skip to content

Tag: jquery

CORS not working php

I am trying to post form data from www.siteone.com to www.sitetwo.com via CORS. My ajax code is this: and the file cors.php in www.sitetwo.com is as follows: But still Access-control-Allow-Origin error is thrown. The error thrown is this: I came to know that, using CORS by just allowing the remote website via…

Jquery removing commas

I’m using the following and it works, but the alerted value opt3 contains commas. How do I remove them? If I select a c & d the alert shows a,c,d but I want it to show acd. Answer What about this? Update: Ok. Like @jreziga mentioned. The return value of .val() will be an array. If you have a string

How to pass variable via AJAX / jQuery?

I would like to know how do I pass a variable to another php-file via AJAX? The variable that has to be passed is called: The problem is that my form in ‘pm_form.php’ has no access to the variable ‘$id’. My script looks like this (this script fires a modal-window and that modal window …

How to Load Ajax in WordPress

I’m familiar with using ajax in the ordinary way with jQuery. I’ve played around it for a while, but don’t understand what WordPress needs to get it to work… What I have here is taken from some …

html2canvas save image doesn’t work

I’m rendering a screenshot with html2canvas 0.4.0 and want to save it as image on my webserver. To do so, I’ve written the following function: JavaScript saveJPG.php After the canvas is rendered I can perfectly append it to the HTML body, but saving it on my server result in a corrupted (?) file. …

jQuery not working when I echo it from PHP

I need only some js to run during some parts of a php script, for testing purposes I commented out the php so I am not going to show it here. The line I have labeled 1B works fine, the background image displays. The section labeled not working seems to have no effect but when I run it separately in

Download a file with an ajax call

I am using PHPExcel to read an excel template, populate the data, and ask the user to download the file. generate_excel.php When I open generate_excel.php directly from the browser, the result file is downloaded. But if I make an ajax call to the generate_excel.php, I don’t get the download prompt. Usin…