Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9020691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:05:02+00:00 2026-06-16T05:05:02+00:00

I have a problem with placing a result from ajax response into a html

  • 0

I have a problem with placing a result from ajax response into a html element. Here is my php which is inserting things into database, the inserting part works but can not get the result into div.

include('konekcija.php');

if ($_POST['form_submitted'] = 1) { 

$aktKod = mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand();
$sifra = $_POST['password'];
$korIme = $_POST['username'];
$email = $_POST['email'];
$upit = "INSERT INTO korisnici(Username,Password,Email,Status,AktivacioniBroj,Uloga) 
VALUES ('$korIme','$sifra','$email','verify',$aktKod,'user') ";
if(mysql_query($upit)) { $return['success'] = "Uspesna registracija"; }
else { $return['error'] = "neuspesna registracija"; }
echo json_encode($return);
mysql_close($conn);  }

Jquery code:

$(document).ready(function() {  
$('#prijava').click(function() {      
$.ajax({
url: "registracija.php",
type: "POST",
dataType:"json",
data: {form_submitted:1, username: $('#user').val(), password: $('#pass').val(), email: $('#email').val()},
succes: function(data) { $('#errorCol').html(data.success); }
});  });  });

And my form in html:

      <form method="POST" name="register" action="" onsubmit="return false">
      <table id="register">

      <tr>
      <td style="padding-bottom:30px; padding-right:20px;"><span style=" font-size:14px; color:#666;">Korisnicko Ime:</span></td>           
      <td><input id="user" type="text" name="username" /></td>                   
      </tr>

      <tr>
      <td style="padding-bottom:30px; padding-right:20px;"><span style=" font-size:14px; color:#666;">Sifra:</span></td>            
      <td> <input id="pass" type="password" name="password" /></td>           
      </tr>

      <tr>
      <td style="padding-bottom:30px; padding-right:20px;"><span style=" font-size:14px; color:#666;">Ponovite Sifru:</span></td>            
      <td> <input id="pass2" type="password" name="password" /></td>           
      </tr>

      <tr>
      <td style="padding-bottom:30px;"><span style=" font-size:14px; color:#666;">Email:</span></td>            
      <td><input id="email" type="text" name="email" /> <input type="hidden" name="form_submitted" value="1"/></td>           
      </tr>

      <tr>                  
      <td style="padding-bottom:30px;" colspan="2" align="center"><input id="prijava" type="submit" value="Prijavi" /></td>           
      </tr>

      <tr>                  
      <td id="errorCol" colspan="2" align="center"></td>           
      </tr>

      </table>
      </form>

So it inserts data into database, but the part where I need to display the response into element with the id of “errorCol” doesn’t work, it just stays empty. Tried to return json array.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:05:03+00:00Added an answer on June 16, 2026 at 5:05 am

    You’ve got a couple of typos in your code.

    1. The php test to see if the form is submitted
      ($_POST['form_submitted'] = 1) is an assignment, it should be a
      double ==, otherwise it will always be true.

    2. In your jquery, the “success” callback is misspelled, you have
      “succes”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have encountered a problem of placing data into the Table View. Here is
so i have a little problem with placing a hover tooltip with jquery -
Ok I have a problem, which is not easy to put a title on.
Problem: Printing from within BIDS 2008 R2 Preview tab hangs and must have the
I have a Html.TextBoxFor which I would like to assign some dynamic javascript to
I am using Ext.data.Store to call a PHP script which returns a JSON response
I've following function for getting HTML template from server and replacing some tags $.ajax({
I have a problem with playing video in mediaplayer. I have a sound but
I am using Xcode 4.3 and i have a problem with playing sound... I
I'm currently playing with reflection and I have problem with my short code: public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.