Results 1 to 2 of 2

Thread: Jquery $post JSON question

  1. #1
    Join Date
    May 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Jquery $post JSON question

    I am unsure as to what may be causing my problem 404 Not Found error. i know the path is there because when i go to the URL i get this error:
    Code:
        {"error":"invalid_order"}
    And this is the javascript code thats calling json:
    Code:
        $.post("<?php echo str_ireplace("http://", "https://", URL_P);?>c/gateway",
    			{
    				unique_id:$("#order_id").val(),
    				name_card:$("#name_card").val(),
    				card_num:$("#card_num").val(),
    				ex_date:$("#ex_date").val(),
    				cvv:$("#cvv").val()	
    			},
    			function(data) {
    				if (data && data != null && data["success"] != null && data["orderid"]) {
    					processSuccess(data["orderid"]);
    				} else if (data && data != null && data["error"] != null) {
    					processError(data["error"]);
    				} else {
    					processError('unknown');
    				}
    				processing = false;
    			},
    			"json"
    	);
    Does anyone see an error in the $post? Is the json $post formed correctly?

    Thanks.

  2. #2
    Join Date
    Jun 2012
    Posts
    12
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Hi
    Seem the problem is in the way you use jQuery $.post .
    Here is the syntax for this Ajax method:
    Code:
    $.post('script.php', data_to_send, function(response){
      $('#dv').html(response);      // adds the server response in element with id="dv"
    });

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •