Skip to main content
2Charlie
Inspiring
March 25, 2016
Answered

How to grab query string values from jQuery Post?

  • March 25, 2016
  • 1 reply
  • 665 views

I have a jQuery that sends the data via post to my proxy ColdFusion page. However, in the this page, I'm not sure how to go about retrieving those values. I tried to log the following in my CFHTTP tag:

<cflog text="URL: #URL#" type="Information" file="CGIparameters">

<cflog text="URL-Name: #URL.name#" type="Information" file="CGIparameters">

But I always get this error:

"NetworkError: 500 Complex object types...erted to simple values. - https://devbox.mysite.com/customcf/kb/proxyPost-KB.cfm"

This is the JavaScript that's posting to the proxy page. However, I don't think there is anything wrong with the JavaScript. I tried putting static values in the CFHTTPPARAM and there is no errors. It was able to send the data to JSON API.

  1. $(function(){
  2.     $("##frmComment").submit(function(event){
  3.         event.preventDefault();
  4.         $("##submitResponse").append('<img src="../../../assets/mysite/img/ajax-loader.gif" class="progressGif">');
  5.         // Cache $form, we'll use that selector more than once
  6.         var $form=$(this);
  7.         var data = $form.serialize(); //get all the data of form
  8.         //post it
  9.         $.post(
  10.         "/customcf/kb/proxyPost-KB.cfm",
  11.         data,
  12.         //console.log(response),
  13.         function(response){
  14.             // Success callback.  Remove your progress gif, eg:
  15.             //$('body').removeClass('in-progress');
  16.             console.log(response);
  17.             // Remove the spining gif from the div
  18.             $("##submitResponse img:last-child").remove();
  19.             //Remove the feedback form
  20.             $("##frmComment").remove();
  21.             $form.fadeOut('slow', function(){
  22.                 //Add response text to the div
  23.                 $("##submitResponse").append("<h6>Thank you for your feedback.</h6>");
  24.                 $("##submitResponse").html(response).fadeIn('slow');
  25.             });
  26.         });
  27.     });
  28. })
This topic has been closed for replies.
Correct answer Steve Sommers

They will be in the FORM or URL scope. This is a very basic question and there are many sources available to learn CF very quickly that you'll want to check out. Here is a thread with a couple: What is the best way to learn ColdFusion

1 reply

Steve SommersCorrect answer
Legend
March 25, 2016

They will be in the FORM or URL scope. This is a very basic question and there are many sources available to learn CF very quickly that you'll want to check out. Here is a thread with a couple: What is the best way to learn ColdFusion

2Charlie
2CharlieAuthor
Inspiring
March 25, 2016

Thanks! I forgot I was supposed to use form scope for post and url for get.