javascript - Scripts loaded through ajax don't send the post data to themselves properly? -



javascript - Scripts loaded through ajax don't send the post data to themselves properly? -

so construction is:

index.php loads /index.php#ajax/landing.php

landing.php has form, form info sent post request (tamper info show post info beingness sent), var_dump($_post); in landing.php showing empty. i'm guessing because of way script loaded post info must beingness sent index.php , must not accessible landing.php?

is there work around this?

i've considered possibility of using ajax send post info , show result in div i'm not , don't understand i'm doing,

so in scenario here i'm trying do:

<form name="search_form" id="search_form" method="post"> <input type="text" name="search" id="search" /> <input type="submit" name="submit_search_form" id="submit_search_form" value="search" /> </form> <div id="search_results"> </div>

how create send post request /php/search.php set results of script post info search results div?

any ideas / help appreciated. note i'm asking post get/query strings can accessed page, isn't appropriate other tasks changing passwords although in scenario i've mentioned fine request, need figure out way post working regardless.

i utilize (which requires jquery):

$(document).ready(function() { // when document loaded function runs $('form').unbind('submit').bind('submit', function(event) { // grab pressing of come in , grab submit action. makes sure form not posted normal way if (event.keycode == 13) { // if come in pressed homecoming false; } pageretrieve($(this).attr('action')+"?"+$(this).serialize(), 'post'); // send info function sends post event.preventdefault(); homecoming false; }); }); function pageretrieve(href, stype) { // function send info server stype = (typeof stype === "undefined") ? "get" : stype; // if 'post' not set in previous function, set $.ajax({ // function send info server url: href, // url send type: stype, // type (post/get) success: function (data) { // when server responds successful $('#search_results').html(data); // set info in div }, error: function () { // if phone call server not right (eg wrong url) alert("error"); } }); }

this posts info specified url in form.

javascript php ajax

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -