Solved

passing a parameter to php and runs the php

Posted on 2014-03-13
4
552 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 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now