• 4

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Form Submission without page refresh [duplicate]

Just catch the submit event and prevent that, then do ajax

$(document).ready(function () {
    $('#myform').on('submit', function(e) {
            url : $(this).attr('action') || window.location.pathname,
            type: "GET",
            data: $(this).serialize(),
            success: function (data) {
            error: function (jXHR, textStatus, errorThrown) {
  • 41
Reply Report
      • 1
    • Adeneo, when i change the url to $(this).attr('action') it will post but will re-direct to the "success" post. How can i call a second php file which will show the records?
      • 1
    • With the form which contains the html.The form
      . there is a successful echo stating that it was posted. There is a second php file listreord.php which is the page im looking to call with ajax
<script type="text/javascript">
    var frm = $('#myform');
    frm.submit(function (ev) {
            type: frm.attr('method'),
            url: frm.attr('action'),
            data: frm.serialize(),
            success: function (data) {


<form id="myform" action="/your_url" method="post">
  • 18
Reply Report
<!-- index.php -->
    <!DOCTYPE html>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <form id="myForm">
        <input type="text" name="fname" id="fname"/>
        <input type="submit" name="click" value="button" />

                    method: 'POST',
                    url: 'submit.php',
                    dataType: "json",
                    contentType: "application/json",
                    data : $('#myForm').serialize(),
                    success: function(data){
                    error: function(xhr, desc, err){
<!-- submit.php -->
$value ="call";
header('Content-Type: application/json');
echo json_encode($value);
  • 2
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions