Solved

passing a parameter to php and runs the php

Posted on 2014-03-13
4
568 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 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 82

Assisted Solution

by:leakim971
leakim971 earned 500 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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

728 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