Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect serialization of url in Ajax request #249

Closed
davidsd opened this issue Feb 20, 2013 · 4 comments
Closed

Incorrect serialization of url in Ajax request #249

davidsd opened this issue Feb 20, 2013 · 4 comments

Comments

@davidsd
Copy link

davidsd commented Feb 20, 2013

In the JQuery module, the JS object finally passed to JQuery is automatically logged to the console. When I call the ajax function from the JQuery module like so

main = ajax "/ajax/example" putStrLn (\_ _ _ -> return ())

then what shows up in the log is

Object {success: function, url: Fay$$Cons, error: function}

in more detail, the members of this object are:

error: function ($p1){
success: function ($p1){
url: Fay$$Cons {
  car: "/"
  cdr: Fay$$Cons {
    car: "a"
    cdr: Fay$$Cons {
      car: "j"
      cdr: Fay$$Cons {
        ...

And the result is that the actual url in the ajax request is http://my.domain.com/[object Object]. It looks like what's happening is that the url isn't being correctly serialized from a Fay list back to a JS string.

@bergmark
Copy link
Member

I noticed this as well. I think the problem is that String is only serialized to a js string if the ffi parameter type is explicit as String. Here we have a record that contains Defined String fields instead. So we can solve by...

  • having Fay always serialize strings into js strings (would be a partial function...)
  • hard coding the ajax queries (then we lose a lot of flexibility)

or preferably

  • wait for fay-text

@chrisdone
Copy link
Contributor

I'd look at the JS output with -p and see why it's not serializing.

@bergmark
Copy link
Member

oh, also #244

@bergmark
Copy link
Member

bergmark commented Jul 1, 2013

I'll close this in favor of that ticket

@bergmark bergmark closed this as completed Jul 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants