LOLWesta, a social media forum

You are not connected. Please login or register

View previous topic View next topic Go down Message [Page 1 of 1]

Append submitted data Empty Append submitted data on Tue Sep 23, 2014 8:32 am

Hello there.

My question is, how can I append submitted data at some page? I'll work with PHP and Javascript's CORS since I want it to appears at my forum.

Here is my code :

Javascript :

(function($, w, r) {
w = w.substr(w.indexOf("/") + 1);
if (!r.test(w)) return;
$.post('form.php', {
TID : w.substr(w.indexOf("form") + 1, w.indexOf("s") - 1),
formPost : encodeURIComponent($('.post').html())
    }).done(function() {
        console.log('Data successfully transferred.');
    }).fail(function() {
        console.log('Failed to send data. Please contact the system administrator if this error persists.');
})(jQuery, window.location.pathname, /\d+/);

PHP code is ongoing.

View user profile

Append submitted data Empty Re: Append submitted data on Tue Sep 23, 2014 10:44 am


LOLWesta King

The JavaScript is pretty similar into the JavaScript in this forum; JavaScript CORS that will get the current unique ID of the topic. It's the uncompressed one, and it's already modified so it won't looks alike. Well I'll just uncompressed it at jsbeautifier and yes the printed result looks very similar into your code. I spend so much time to create the script. And yes you're spending some time, but you're just converting it and re-write it. Or maybe, modified it. And it spend your time for less from one minute.

Anyway, back to the topic. Why not use AJAX for it? It's more simple, and more easy to code.

View user profile

Append submitted data Empty Re: Append submitted data on Wed Dec 24, 2014 11:34 am


With this, I believe.

$(document).ready(function() {
$('#submitbutton').click(function(e) {
var datacmprs = $('#datacmprs');

Just some random script I'll found in the internet. .

View user profile

Append submitted data Empty Re: Append submitted data on Sat Jan 17, 2015 11:36 am


Try accessing the script.php with jQuery.get method and get the value.

Something like this (don't do so, it's just an example) :

$(function() {
$.get('script.php', function(data) {

View user profile

Sponsored content

View previous topic View next topic Back to top Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum