-
- AJAX Form Submit
-
- AJAX Form Submit
-
-
-
AJAX Form Submit
Thanks for the answer but it's still giving the same result. It's still just outputting the html source into the textarea. Anything else that could be causing this? This may help actually. I used to be doing it like this: <textarea type="text" id="myOutput" placeholder="Preview"><?php echo $message; ?> </textarea> It's specifically the message variable I want. This actually works, when I hit submit it shows the correct message value in the textarea. I was just trying to get it to do it without the page refresh.
-
AJAX Form Submit
I'm trying to get this form to submit and post all the data to a text area without a page refresh. The form works fine, but since adding the js, when I hit submit it just copies a few blank lines into to the textarea. I've tried to debug this and used: $(document).ready(function () { $('#myForm').on('submit', function(e) { e.preventDefault(); $.ajax({ url : $(this).attr('action') || window.location.pathname, type: "GET", data: $(this).serialize(), success: function (data) { //tried this to debug alert(data); }, error: function (jXHR, textStatus, errorThrown) { alert(errorThrown); } }); }); }); And this just returns the full source of the document. Not sure why, any ideas? Full source below. PHP <?php if(!empty($_POST["project"])) { $description = Trim(stripslashes($_POST["description"])); $array = $_POST["data"]; $subtotal = Trim(stripslashes($_POST["subtotal"])); $discount = Trim(stripslashes($_POST["discount"])); $total = Trim(stripslashes($_POST["total"])); $time = Trim(stripslashes($_POST["time"])); $Organisation = Trim(stripslashes($_POST["Organisation"])); $full = Trim(stripslashes($_POST["full"])); $first = Trim(stripslashes($_POST["first"])); $email = Trim(stripslashes($_POST["email"])); $n1 = "\r\n"; $n2 = "\r\n\r\n"; $message = "Hello"; } ?> JS $(document).ready(function () { $('#myForm').on('submit', function(e) { e.preventDefault(); $.ajax({ url : $(this).attr('action') || window.location.pathname, type: "GET", data: $(this).serialize(), success: function (data) { $("#myOutput").html(data); }, error: function (jXHR, textStatus, errorThrown) { alert(errorThrown); } }); }); }); HTML <form id="myForm" method="post"> <input name="project" type="submit" value="OK"> </form> <textarea type="text" id="myOutput"></textarea>
-
-
Directory Delete Blank Page
Oookay! Yes it was an issue with the returns. They did confuse me a little when I first found the script but everyone else using it said it worked. This works for me: chmod("1", 0777); chmod("1/images", 0777); chmod("1/scripts", 0777); chmod("1/uploads", 0777); $path = "1"; if (is_dir($path) === true) { $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path) , RecursiveIteratorIterator::CHILD_FIRST); foreach($files as $file) { if (in_array($file->getBasename() , array( '.', '..' )) !== true) { if ($file->isDir() === true) { rmdir($file->getPathName()); } else if (($file->isFile() === true) || ($file->isLink() === true)) { unlink($file->getPathname()); } } } rmdir($path); } else if ((is_file($path) === true) || (is_link($path) === true)) { unlink($path); } Basically removed the returns and removed the end return false. Pretty sure this is fine now but if you can see any issues please let me know, but if not thanks for the help Nock! (:
-
Directory Delete Blank Page
Well, all my php scripts always return to the page I was on after running, so that's what I wanted it to do ideally. I just thought there was something wrong with the script because it was sticking on a white screen. Regarding the echo, I actually tried that. Here's what I get with an echo: If the script finds and delets the folder: Blank page If the script doesn't find the folder: Warning: chmod(): No such file or directory in /home/domain/public_html/clients/index.php on line 95 Warning: chmod(): No such file or directory in /home/domain/public_html/clients/index.php on line 96 Warning: chmod(): No such file or directory in /home/domain/public_html/clients/index.php on line 97 Warning: chmod(): No such file or directory in /home/domain/public_html/clients/index.php on line 98 all done So the script returns as usual if the script fails, but if it works it stick on a blank page?
-
Directory Delete Blank Page
I have this script which copies files from an existing folder (client) to a new folder (1). $root = __DIR__; mkdir("$root/1",0755,true); $source = "$root/client"; $dest= "$root/1"; foreach ( $iterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator($source,\RecursiveDirectoryIterator::SKIP_DOTS),\RecursiveIteratorIterator::SELF_FIRST) as $item) { if ($item->isDir()) { mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName()); } else { copy($item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName()); } } I am then deleting that new folder with this: //chmod The folders from 755 to 777 ready to delete chmod("1", 0777); chmod("1/images", 0777); chmod("1/scripts", 0777); chmod("1/uploads", 0777); //Set Path to directory to be deleted $path = "1"; //Delete Directory if (is_dir($path) === true) { $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path) , RecursiveIteratorIterator::CHILD_FIRST); foreach($files as $file) { if (in_array($file->getBasename() , array( '.', '..' )) !== true) { if ($file->isDir() === true) { rmdir($file->getPathName()); } else if (($file->isFile() === true) || ($file->isLink() === true)) { unlink($file->getPathname()); } } } return rmdir($path); } else if ((is_file($path) === true) || (is_link($path) === true)) { return unlink($path); } return false; The script works, however once the scripts been run it sticks at a white page. I've tried all sorts of error reporting and they all show nothing, there are also no error logs. Wondered if anyone had any idea why?
-
-
Add row beneath clicked row dynamic form
var cols = ""; $(document).on('click', '.addButton', function(e){ var newRow = row.clone(); var regex = new RegExp("data\[[0-9]+\]", "g"); newRow.html(newRow.html().replace(regex, "data[" + (++count) + "]")); newRow.append(cols); newRow.insertAfter( $(this).closest("tr") ); }); That did it, not sure what the cols bit is doing exactly but it works (: heh. Thanks once again Drama Queen!
-
Add row beneath clicked row dynamic form
Sorry, actually on testing it it's not quite what I was after, what I'm looking for is more of an insert feature. I've actually just found a jsfiddle with what I'm after in, so I'm trying to figure out how to get it into mine! http://jsfiddle.net/rplantiko/cDa3N/ Pretty sure it's these I'm after: newRow.append(cols); newRow.insertAfter( $(this).closest("tr") );
-
Add row beneath clicked row dynamic form
Yeeess! That's it, was trying all sorts yours seems so simple x) heh. Thanks for the help, greatly appreciated Drama Queen!
-
-
Add row beneath clicked row dynamic form
Ahhh, I see! thanks a lot for the help! Still not sure about the how to get it underneath kinda thing but I'll go see if I can figure it out (: Thankyou (:
-
Add row beneath clicked row dynamic form
Anyone know anything about this? Really struggling to figure this out
-
Add row beneath clicked row dynamic form
Hey guys, I'm trying to get this "add row" button to add a row under the one that's clicked.So: Click "add row" > Adds a row beneath which ever button was clicked. At the moment the top button is the only one that will add a row, and it adds it to the bttom of all the rows. Here's a jsfiddle of what I mean. http://jsfiddle.net/re2af/194/ Does anyone know how to achieve this?
-
- Form rows not deleting
- Form rows not deleting