Ok I managed to get something extremely simplified so that even I can understand it and someone can hopefully understand what I'm trying to do lol. Only one problem I have. I want the jQuery to just display whatever the PHP sends back to it, instead of having to go through all the json crap and having the jQuery handle what gets shown. Ex (I use tabs so the indents are gone sry):
The js/jquery:
Quote:
<script type="text/javascript">
function readPage(keyPage, jsNum, aNum)
{
if(aNum==1)
{
$(document).ready(function()
{
$.post("ajaxwork.php?a=import_videos", $("#target").serialize(),
function(data){$("#ajaxCol"+jsNum).html(data.delim iter);}, "json");
});
}
}
</script>
|
The HTML:
Quote:
<form id="target" action="javascript:readPage('page.php?a=do_this', 1, 1);">
Delimiter: <input name="delimiter" value="|" size=1><br>
<input type=submit value="Next">
</form>
<div id="ajaxCol1" style="display:inline;"></div>
|
And the PHP:
Quote:
<?php
if($_GET['a']=="do_this")
{
$return_json = "{'delimiter':'".$_POST['delimiter']."'}";
echo $return_json;
}
?>
|
Should I just change the:
$return_json = "{'delimiter':'".$_POST['delimiter']."'}";
and make it send all the HTML/etc I want to display? Like:
$everything="<b>blah blah blah ".$_POST['delimiter']."</b>";
$return_json = "{'everything':'$everything'}";
Edit: it works^ I guess I will just do it that way, but idk if it's the wrong way or it doesn't matter or what. I just don't want to handle all the printing and HTML in jquery because it's really going to clutter a lot of shit up. And having to rename all the $_POST's is just stupid imo I don't really understand the whole json thing.