Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

passing a parameter to php and runs the php

Posted on 2014-03-13
4
Medium Priority
?
580 Views
Last Modified: 2014-03-13
Hi,

$(td).click and ajax combination runs the php with the passed parameter, and then return the result from the php, this works perfect in some of my cases. But I need to send the parameter and runs the php and displays the php page result in a new tab in the browser, not in the same page where the ajax is called. the php page have many echos and create a webpage, but needs some parameters that are received from the ajax, like $(this).html(). How i can do that?
0
Comment
Question by:joyacv2
  • 2
  • 2
4 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 39927226
$("td").click(function() {
      var p = encodeURIComponent( $(this).html() );
      window.open("/newtaburl.php?you_dont_need_ajax_param="+p,"_blank"); // $_GET or $_REQUEST
});

Open in new window

0
 
LVL 1

Author Comment

by:joyacv2
ID: 39927329
hi, is possible to do with post?
0
 
LVL 83

Assisted Solution

by:leakim971
leakim971 earned 2000 total points
ID: 39927365
$("td").click(function() {
      var p = encodeURIComponent( $(this).html() );
      var key = "key" + new Date().getTime();
      var data = { "param":p, "key":key };
      var url = "/save_this_inside_a_SESSION_for_this_key.php";
      var success = function() {
              window.open("/newtaburl.php?key="+key,"_blank");
      };
      $.post(url, data, success);
});

Open in new window


<?php
session_start();
$_SESSION[ $_POST["key"] ] = $_POST["param"];
echo "ok";
?>

Open in new window

0
 
LVL 1

Author Closing Comment

by:joyacv2
ID: 39927493
excellent!!!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question