Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Closed Thread
Post variable to page with javascript/jquery (jQuery.post)
Old 01-28-2011, 06:36 PM Post variable to page with javascript/jquery (jQuery.post)
Experienced Talker

Posts: 43
Trades: 0
I'm trying to pass-trough a php variable with javascript to another php page.
I know it sounds over complicated but i cant use a regular php form and use the POST method because it needs to get pass-through when the page loads.

So i thought this should be possible with javascript/ajax/jquery etc and i know its possible so i thought lets try it with jQuery.post (http://api.jquery.com/jQuery.post/)

This is what i got so far:

On post.php
Code:
<script type="text/javascript">
function postTest() {
$.post("test.php", {testString: "11"}, function(data) {}
);
}

</script>
</head>
<body onLoad="getInfo()">
on test.php
Code:
<?php
$testString = $_POST['testString'];


echo $testString;
?>
So i need help with this jQuery.post thing because i keep getting no results. Anyone who has experience with this sort of things because i have no clue what i'm doing wrong.
TheSir is offline
View Public Profile
 
 
Register now for full access!
Old 01-28-2011, 07:11 PM Re: Post variable to page with javascript/jquery (jQuery.post)
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
The data var holds the return value.

Code:
$.post("test.php", {testString: "11"}, function(data){
    
    alert(data);
});
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
View Public Profile
 
Old 01-31-2011, 09:54 AM Re: Post variable to page with javascript/jquery (jQuery.post)
Experienced Talker

Posts: 43
Trades: 0
Thx for your reply, but i gave up. Cant get it to work like i need it and made a work around this what will do for now.
TheSir is offline
View Public Profile
 
Closed Thread     « Reply to Post variable to page with javascript/jquery (jQuery.post)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17340 seconds with 12 queries