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 9005225
In Process

The Archive Base Latest Questions

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

I know i already asked simillar question, but now when I work with jQuery

  • 0

I know i already asked simillar question, but now when I work with jQuery Mobile I can’t figure it out. So I have this form:

<div data-role="page" data-theme="a" id="login_page">
        <div data-role="header" data-position="fixed">
            <h1>****</h1>
        </div>
        <div data-role="content">
            <form id="login_form" method="POST" data-ajax="false">
            <label for="basic">Username:</label>
            <input type="text" name="name" id="username" value=""/>
            <label for="basic">Password:</label>
            <input type="password" name="password" id="password" value=""/>
            <input type="submit" value="Login" id="login" name="login"/>
            </form>
        </div>
        <div data-role="footer" data-position="fixed">
            <div data-role="navbar"></div>
        </div>
</div>

And I need to submit Username and Password to php script, where php replies and send “success” or “failed”. Here is php:

<?php
session_start();

$username = $_POST["name"];
$password = $_POST["password"];

include('mysql_connection.php');
mysql_select_db("jzperson_imesUsers", $con);

$res1 = mysql_query("SELECT * FROM temp_login WHERE username='$username' AND password='$password'");
$count=mysql_num_rows($res1);

if($count==1){
    echo "success";
}else{
    echo "failed";
}
?>

And to do all this I want to use this script:

$(document).ready(function() {
        $("form").submit(function(){
            $.mobile.showPageLoadingMsg();

            $.ajax({
                url: "http://imes.jzpersonal.com/login_control.php",
                type: "POST",
                dataType: "jsonp",
                jsonp: "jsoncallback",
                data: $("form#login_form").serialize(),
                success: function( response ){
                    $.mobile.changePage( "http://imes.jzpersonal.com/user_panel.html");
                }
            });
            return false;
        });
    });

But I can’t make it work, I know I must have mistakes in there, I just can’t find them, or better way to do it. Thank you in advance for any help.

  • 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-16T01:05:18+00:00Added an answer on June 16, 2026 at 1:05 am

    You have few mistakes.

    I. JSONP only allows type: “GET” but you can remove it altogether.

    This is a working example of JSONP $.ajax call:

       $.ajax({url: server_url,
            data: save_data,
            dataType: "jsonp",
            jsonpCallback: 'successCallback',
            async: true,
            beforeSend: function() {
                $.mobile.showPageLoadingMsg(true);
            },
            complete: function() {
                $.mobile.hidePageLoadingMsg();
            },
            success: function (result) {
                alert(result);
            },
            error: function (request,error) {
                alert(error);
            }, 
           successCallback:function(){
    
            }
        });
    

    II. Now the main thing, because you are using JSON/JSONP you cant just use echo “SOME_STRING” in PHP. First you must use a json_encode() function to format correctly your result data and the you need to wrap it in your jsonpCallback function:

    echo $_GET['callback'] . '(' . "{'some' : 'example'}" . ')';
    

    or:

    echo $_GET['callback'] . '(' . ###your_serialized_json_output### . ')';
    

    III. And finally you need to modify your server so it can handle JSONP calls.

    Here you will find more about it:

    http://www.geekality.net/2010/06/27/php-how-to-easily-provide-json-and-jsonp/

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

Sidebar

Related Questions

I know this question has already asked here, but I can't figure this one
I know this question has already been asked, but the solution doesn't work in
I know some have already asked the question but so far, the answers are
i know i asked already the question about the ping script but now i
I know I already asked related question but now it's a bit different situation.
I know this is an already asked question, but I couldn't find any solution.
I guess this question that would have already been asked here. I searched but
I know this question was already asked, but mine is a little different: I
I know this is a similar question to one already asked, but I was
i know this has already been asked here in stackoverflow, but i could not

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.